fix: can't generate traceID when use noop exporter (#33191)

relate: https://github.com/milvus-io/milvus/issues/33190

Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
aoiasd 2024-05-21 10:39:39 +08:00 committed by GitHub
parent 89ad3eb0ca
commit f8929cc36a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,7 +29,6 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdk "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"
"github.com/milvus-io/milvus/pkg/log"
@ -63,11 +62,6 @@ func CloseTracerProvider(ctx context.Context) error {
}
func SetTracerProvider(exp sdk.SpanExporter, traceIDRatio float64) {
if exp == nil {
otel.SetTracerProvider(trace.NewNoopTracerProvider())
return
}
tp := sdk.NewTracerProvider(
sdk.WithBatcher(exp),
sdk.WithResource(resource.NewWithAttributes(