From 13a2388f1e4e5ed4c1e1676650778b56f2e5de1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Samin?= Date: Thu, 11 Oct 2018 10:13:00 +0200 Subject: [PATCH] fix(api): http pprof labels (#3441) --- engine/api/router.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/api/router.go b/engine/api/router.go index 7cb72bbb0c..4297ba4c06 100644 --- a/engine/api/router.go +++ b/engine/api/router.go @@ -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) } }