Skip to content

Commit

Permalink
enhance: change tracing span name from request uri to router uri for …
Browse files Browse the repository at this point in the history
…http request (#3338)
  • Loading branch information
seth-shi authored Mar 5, 2024
1 parent 680ae86 commit df15d70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/ghttp/ghttp_middleware_tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ func internalMiddlewareServerTracing(r *Request) {
// Continue executing.
r.Middleware.Next()

// parse after set route as span name
if r.Router.Uri != defaultMiddlewarePattern || r.Router.RegNames != nil {
span.SetName(r.Router.Uri)
}

// Error logging.
if err = r.GetError(); err != nil {
span.SetStatus(codes.Error, fmt.Sprintf(`%+v`, err))
Expand Down

0 comments on commit df15d70

Please sign in to comment.