package tracetest
import "go.opentelemetry.io/otel/sdk/trace/tracetest"
Package tracetest is a testing helper package for the SDK. User can configure no-op or in-memory exporters to verify different SDK behaviors or custom instrumentation.
Index ¶
- type InMemoryExporter
- func NewInMemoryExporter() *InMemoryExporter
- func (imsb *InMemoryExporter) ExportSpans(_ context.Context, ss []*trace.SpanSnapshot) error
- func (imsb *InMemoryExporter) GetSpans() []*trace.SpanSnapshot
- func (imsb *InMemoryExporter) Reset()
- func (imsb *InMemoryExporter) Shutdown(context.Context) error
- type NoopExporter
Types ¶
type InMemoryExporter ¶
type InMemoryExporter struct {
// contains filtered or unexported fields
}
InMemoryExporter is an exporter that stores all received spans in-memory.
func NewInMemoryExporter ¶
func NewInMemoryExporter() *InMemoryExporter
NewInMemoryExporter returns a new InMemoryExporter.
func (*InMemoryExporter) ExportSpans ¶
func (imsb *InMemoryExporter) ExportSpans(_ context.Context, ss []*trace.SpanSnapshot) error
ExportSpans handles export of SpanSnapshots by storing them in memory.
func (*InMemoryExporter) GetSpans ¶
func (imsb *InMemoryExporter) GetSpans() []*trace.SpanSnapshot
GetSpans returns the current in-memory stored spans.
func (*InMemoryExporter) Reset ¶
func (imsb *InMemoryExporter) Reset()
Reset the current in-memory storage.
func (*InMemoryExporter) Shutdown ¶
func (imsb *InMemoryExporter) Shutdown(context.Context) error
Shutdown stops the exporter by clearing SpanSnapshots held in memory.
type NoopExporter ¶
type NoopExporter struct{}
NoopExporter is an exporter that drops all received SpanSnapshots and performs no action.
func NewNoopExporter ¶
func NewNoopExporter() *NoopExporter
NewNoopExporter returns a new no-op exporter.
func (*NoopExporter) ExportSpans ¶
func (nsb *NoopExporter) ExportSpans(context.Context, []*trace.SpanSnapshot) error
ExportSpans handles export of SpanSnapshots by dropping them.
func (*NoopExporter) Shutdown ¶
func (nsb *NoopExporter) Shutdown(context.Context) error
Shutdown stops the exporter by doing nothing.
Source Files ¶
test.go
- Version
- v0.20.0
- Published
- Apr 23, 2021
- Platform
- windows/amd64
- Imports
- 3 packages
- Last checked
- 49 minutes ago –
Tools for package owners.