diff --git a/tracing/setup.go b/tracing/setup.go index 0d20478..2fca75b 100644 --- a/tracing/setup.go +++ b/tracing/setup.go @@ -3,7 +3,6 @@ package tracing import ( "context" "fmt" - "io" "sync" "sync/atomic" @@ -12,6 +11,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/sdk/trace/tracetest" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace/noop" @@ -133,7 +133,7 @@ func getExporter(ctx context.Context, cfg *Config) (sdktrace.SpanExporter, error case StdoutExporter: return stdouttrace.New() case NoOpExporter: - return stdouttrace.New(stdouttrace.WithWriter(io.Discard)) + return tracetest.NewNoopExporter(), nil case OTLPgRPCExporter: return otlptracegrpc.New(ctx, otlptracegrpc.WithEndpoint(cfg.Endpoint), otlptracegrpc.WithInsecure()) }