connect contexts managed by fiber middleware to join at c.UserContext()
This commit is contained in:
@ -44,9 +44,11 @@ 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) {
|
||||
ctx := fiberOpentelemetry.FromCtx(c)
|
||||
return fiberOpentelemetry.Tracer.Start(ctx, c.Method()+" "+c.Path(), opts...)
|
||||
link := trace.LinkFromContext(fiberOpentelemetry.FromCtx(c))
|
||||
opts = append(opts, trace.WithLinks(link))
|
||||
return fiberOpentelemetry.Tracer.Start(c.UserContext(), c.Method()+" "+c.Path(), opts...)
|
||||
}
|
||||
|
||||
// Retrieve span using [fiber.Ctx]
|
||||
|
Reference in New Issue
Block a user