make span names more generic by using OriginalURL instead of Path
This commit is contained in:
parent
031177f30c
commit
4ef53d77aa
@ -51,6 +51,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
main.Get("/", Handler)
|
main.Get("/", Handler)
|
||||||
|
main.Get("/just/some/more/complex/path/:with/params", Handler)
|
||||||
|
|
||||||
// handle interrupts (shutdown)
|
// handle interrupts (shutdown)
|
||||||
c := make(chan os.Signal, 1)
|
c := make(chan os.Signal, 1)
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
GET http://127.0.0.1:3344/
|
GET http://127.0.0.1:3344/
|
||||||
HTTP 200
|
HTTP 500
|
||||||
|
|
||||||
|
GET http://127.0.0.1:3344/just/some/more/complex/path/:with/params
|
||||||
|
HTTP 500
|
||||||
|
@ -48,7 +48,7 @@ func Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption)
|
|||||||
func FStart(c *fiber.Ctx, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
|
func FStart(c *fiber.Ctx, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
|
||||||
span := trace.SpanFromContext(fiberOpentelemetry.FromCtx(c))
|
span := trace.SpanFromContext(fiberOpentelemetry.FromCtx(c))
|
||||||
c.SetUserContext(trace.ContextWithSpan(c.UserContext(), span))
|
c.SetUserContext(trace.ContextWithSpan(c.UserContext(), span))
|
||||||
return fiberOpentelemetry.Tracer.Start(c.UserContext(), c.Method()+" "+c.Path(), opts...)
|
return fiberOpentelemetry.Tracer.Start(c.UserContext(), c.Method()+" "+c.OriginalURL(), opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve span using [fiber.Ctx]
|
// Retrieve span using [fiber.Ctx]
|
||||||
|
Loading…
Reference in New Issue
Block a user