From a4a4dca2b2e64cc70a1a719c5f3dbf7a5c81adba Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Thu, 24 Oct 2024 13:41:26 -0700 Subject: [PATCH] add a span tag for content type if the header is set (#614) Signed-off-by: Callum Styan --- middleware/http_tracing.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/middleware/http_tracing.go b/middleware/http_tracing.go index d75535ebe..b7dfe2d59 100644 --- a/middleware/http_tracing.go +++ b/middleware/http_tracing.go @@ -38,6 +38,11 @@ func (t Tracer) Wrap(next http.Handler) http.Handler { sp.SetTag("http.user_agent", userAgent) } + // add the content type, useful when query requests are sent as POST + if ct := r.Header.Get("Content-Type"); ct != "" { + sp.SetTag("http.content_type", ct) + } + // add a tag with the client's sourceIPs to the span, if a // SourceIPExtractor is given. if t.SourceIPs != nil {