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/propagation"
"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"
"go.opentelemetry.io/otel/trace"
)
@ -71,7 +71,7 @@ func NewServer(config *Config) (*Server, error) {
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())
if err != nil {
return nil, err
@ -81,9 +81,9 @@ func tracerProvider(url string) (*tracesdk.TracerProvider, error) {
semconv.ServiceName("mf-proxy"),
semconv.ServiceVersion(proxy.Version),
)
tp := tracesdk.NewTracerProvider(
tracesdk.WithBatcher(exp, tracesdk.WithBatchTimeout(time.Second)),
tracesdk.WithResource(res),
tp := sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exp, sdktrace.WithBatchTimeout(time.Second)),
sdktrace.WithResource(res),
)
otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))