Rename tracesdk to sdktrace

This commit is contained in:
Torjus Håkestad 2023-10-23 21:24:28 +02:00
parent b786c6558e
commit 160f4dd2ae

View File

@ -21,7 +21,7 @@ import (
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
"go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace" sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0" semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
) )
@ -71,7 +71,7 @@ func NewServer(config *Config) (*Server, error) {
return srv, nil return srv, nil
} }
func tracerProvider(url string) (*tracesdk.TracerProvider, error) { func tracerProvider(url string) (*sdktrace.TracerProvider, error) {
exp, err := otlptracehttp.New(context.Background(), otlptracehttp.WithEndpoint(url), otlptracehttp.WithInsecure()) exp, err := otlptracehttp.New(context.Background(), otlptracehttp.WithEndpoint(url), otlptracehttp.WithInsecure())
if err != nil { if err != nil {
return nil, err return nil, err
@ -81,9 +81,9 @@ func tracerProvider(url string) (*tracesdk.TracerProvider, error) {
semconv.ServiceName("mf-proxy"), semconv.ServiceName("mf-proxy"),
semconv.ServiceVersion(proxy.Version), semconv.ServiceVersion(proxy.Version),
) )
tp := tracesdk.NewTracerProvider( tp := sdktrace.NewTracerProvider(
tracesdk.WithBatcher(exp, tracesdk.WithBatchTimeout(time.Second)), sdktrace.WithBatcher(exp, sdktrace.WithBatchTimeout(time.Second)),
tracesdk.WithResource(res), sdktrace.WithResource(res),
) )
otel.SetTracerProvider(tp) otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))