Skip to content

Commit

Permalink
chore(middleware/tracing): Adjust support for backward compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Flc゛ <[email protected]>
  • Loading branch information
flc1125 committed Sep 11, 2024
1 parent 86905a2 commit 71d65bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions middleware/tracing/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 71d65bb

Please sign in to comment.