[#12] tracing: Optimize noop exporter
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
cb37f5975e
commit
6dd265d949
1 changed files with 2 additions and 2 deletions
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue