From 71d65bb0247799e4139b3dfad419b23449f014ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Flc=E3=82=9B?= Date: Wed, 11 Sep 2024 10:50:36 +0800 Subject: [PATCH] chore(middleware/tracing): Adjust support for backward compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Flcă‚› --- middleware/tracing/span.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/middleware/tracing/span.go b/middleware/tracing/span.go index fc22943fbe2..9c8672d28c9 100644 --- a/middleware/tracing/span.go +++ b/middleware/tracing/span.go @@ -33,9 +33,11 @@ func setClientSpan(ctx context.Context, span trace.Span, m interface{}) { case transport.KindHTTP: if ht, ok := tr.(http.Transporter); ok { attrs = append(attrs, + // nolint:staticcheck semconv.HTTPMethod(ht.Request().Method), // deprecated, use HTTPRequestMethodKey semconv.HTTPRequestMethodKey.String(ht.Request().Method), semconv.HTTPRouteKey.String(ht.PathTemplate()), + // nolint:staticcheck semconv.HTTPTarget(ht.Request().URL.Path), // deprecated, use URLPath, URLQuery semconv.URLFragment(ht.Request().URL.Fragment), semconv.URLPath(ht.Request().URL.Path), @@ -78,9 +80,11 @@ func setServerSpan(ctx context.Context, span trace.Span, m interface{}) { case transport.KindHTTP: if ht, ok := tr.(http.Transporter); ok { attrs = append(attrs, + // nolint:staticcheck semconv.HTTPMethod(ht.Request().Method), // deprecated, use HTTPRequestMethodKey semconv.HTTPRequestMethodKey.String(ht.Request().Method), semconv.HTTPRouteKey.String(ht.PathTemplate()), + // nolint:staticcheck semconv.HTTPTarget(ht.Request().URL.Path), // deprecated, use URLPath, URLQuery semconv.URLFragment(ht.Request().URL.Fragment), semconv.URLPath(ht.Request().URL.Path),