From c5c7f9296016deedc5fef69858973040d4b10c47 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 22 Jul 2015 00:27:55 +0200 Subject: [PATCH] Fix /debug/pprof endpoint with new web router. This got broken in https://github.com/prometheus/prometheus/commit/78047326b487fcfccb25fbaaa2fb5c13397ad97b since it stopped using the DefaultServeMux. This approach will defer pprof requests to the DefaultServeMux, which may or may not have pprof enabled (in Prometheus, it gets it included in main.go). An alternative approach would be to duplicate the four lines in https://golang.org/src/net/http/pprof/pprof.go#L62. When choosing that approach though, we would not automatically gain any new endpoints added by net/http/pprof or other /debug endpoints in the future. --- web/web.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/web.go b/web/web.go index e2642d9f52..5fe92cf5d8 100644 --- a/web/web.go +++ b/web/web.go @@ -171,6 +171,8 @@ func New(st local.Storage, qe *promql.Engine, rm *rules.Manager, status *Prometh router.Post("/-/quit", h.quit) } + router.Get("/debug/*subpath", http.DefaultServeMux.ServeHTTP) + return h }