diff --git a/pkg/infra/tracing/opentelemetry_tracing.go b/pkg/infra/tracing/opentelemetry_tracing.go index e502b9350ba..1e0da774cb9 100644 --- a/pkg/infra/tracing/opentelemetry_tracing.go +++ b/pkg/infra/tracing/opentelemetry_tracing.go @@ -96,11 +96,11 @@ func (ots *Opentelemetry) parseSettingsOpentelemetry() error { ots.enabled = noopExporter ots.address = section.Key("address").MustString("") + ots.propagation = section.Key("propagation").MustString("") if ots.address != "" { ots.enabled = jaegerExporter return nil } - ots.propagation = section.Key("propagation").MustString("") section, err = ots.Cfg.Raw.GetSection("tracing.opentelemetry.otlp") if err != nil { @@ -234,7 +234,7 @@ func (ots *Opentelemetry) Run(ctx context.Context) error { } func (ots *Opentelemetry) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, Span) { - ctx, span := ots.tracer.Start(ctx, spanName) + ctx, span := ots.tracer.Start(ctx, spanName, opts...) opentelemetrySpan := OpentelemetrySpan{ span: span, } diff --git a/pkg/middleware/request_tracing.go b/pkg/middleware/request_tracing.go index c03e10a2b1d..64fe6311eb6 100644 --- a/pkg/middleware/request_tracing.go +++ b/pkg/middleware/request_tracing.go @@ -72,7 +72,7 @@ func RequestTracing(tracer tracing.Tracer) web.Middleware { rw := web.Rw(w, req) wireContext := otel.GetTextMapPropagator().Extract(req.Context(), propagation.HeaderCarrier(req.Header)) - ctx, span := tracer.Start(req.Context(), fmt.Sprintf("HTTP %s %s", req.Method, req.URL.Path), trace.WithLinks(trace.LinkFromContext(wireContext))) + ctx, span := tracer.Start(wireContext, fmt.Sprintf("HTTP %s %s", req.Method, req.URL.Path), trace.WithLinks(trace.LinkFromContext(wireContext))) req = req.WithContext(ctx) next.ServeHTTP(w, req)