From 520c8598dc2fe42b1a4a0e7d662a5c8512e8d0c1 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Tue, 16 Aug 2022 11:00:49 +0100 Subject: [PATCH] Call HTTP server span names as the request URI path --- tracing/tracing.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tracing/tracing.go b/tracing/tracing.go index 739eda6..000ceb5 100644 --- a/tracing/tracing.go +++ b/tracing/tracing.go @@ -168,5 +168,9 @@ func WrapHandler(h http.Handler, endpointAddr string) http.Handler { if !Enabled { return h } - return othttp.NewHandler(h, serviceName) + + // Format span names with the request URL path. + return othttp.NewHandler(h, serviceName, othttp.WithSpanNameFormatter(func(op string, r *http.Request) string { + return r.URL.Path + })) } -- GitLab