diff --git a/pkg/fiber_tracing/fiber_tracing.go b/pkg/fiber_tracing/fiber_tracing.go index 6503207..54daf12 100644 --- a/pkg/fiber_tracing/fiber_tracing.go +++ b/pkg/fiber_tracing/fiber_tracing.go @@ -46,14 +46,15 @@ func Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) // NOTE: You can use [trace.WithAttributes] as a parameter to opts argument // Returns [c.UserContext] as [context.Context] func FStart(c *fiber.Ctx, opts ...trace.SpanStartOption) (context.Context, trace.Span) { - link := trace.LinkFromContext(fiberOpentelemetry.FromCtx(c)) - opts = append(opts, trace.WithLinks(link)) + span := trace.SpanFromContext(fiberOpentelemetry.FromCtx(c)) + c.SetUserContext(trace.ContextWithSpan(c.UserContext(), span)) return fiberOpentelemetry.Tracer.Start(c.UserContext(), c.Method()+" "+c.Path(), opts...) } // Retrieve span using [fiber.Ctx] func SpanFromContext(c *fiber.Ctx) trace.Span { ctx := fiberOpentelemetry.FromCtx(c) + c.SetUserContext(trace.ContextWithSpan(c.UserContext(), trace.SpanFromContext(ctx))) return trace.SpanFromContext(ctx) }