Skip to content

Commit

Permalink
fix(api): http pprof labels (#3441)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin authored and sguiheux committed Oct 11, 2018
1 parent cc8b7fb commit 13a2388
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions engine/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ type HandlerConfigFunc func(service.Handler, ...HandlerConfigParam) *service.Han
func (r *Router) pprofLabel(fn http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
labels := pprof.Labels("http-path", r.URL.Path)
pprof.Do(r.Context(), labels, func(ctx context.Context) {
fn.ServeHTTP(w, r)
})
ctx := pprof.WithLabels(r.Context(), labels)
pprof.SetGoroutineLabels(ctx)
r = r.WithContext(ctx)
fn(w, r)
}
}

Expand Down

0 comments on commit 13a2388

Please sign in to comment.