diff --git a/internal/api/router.go b/internal/api/router.go index a9025f2ca..a8407ac79 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -3,6 +3,7 @@ package api import ( "github.com/formancehq/go-libs/v2/api" "github.com/formancehq/ledger/internal/controller/system" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" nooptracer "go.opentelemetry.io/otel/trace/noop" "net/http" @@ -47,6 +48,17 @@ func NewRouter( middleware.RequestLogger(api.NewLogFormatter()), } + if debug { + commonMiddlewares = append(commonMiddlewares, func(handler http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + trace.SpanFromContext(r.Context()). + SetAttributes(attribute.String("raw-query", r.URL.RawQuery)) + + handler.ServeHTTP(w, r) + }) + }) + } + v2Router := v2.NewRouter( systemController, authenticator,