Use index endpoint with a trailing slash

On using `/debug/pprof` as index endpoint, profiles contained by it
would point to wrong url. For example, link for `allocs` would be
`/debug/allocs` (results in 404), whereas it should actually be
`/debug/pprof/allocs`.

Use a trailing slash to get correct links. `/debug/pprof` will
automatically be redirected to `/debug/pprof/`
This commit is contained in:
Kishan Mohanbhai Sagathiya 2019-11-28 00:32:48 +05:30
parent d628558aeb
commit 42b1413e23

View File

@ -113,7 +113,7 @@ func setupMetrics(cfg *MetricsConfig) error {
zpages.Handle(mux, "/debug")
mux.Handle("/metrics", pe)
mux.Handle("/debug/vars", expvar.Handler())
mux.HandleFunc("/debug/pprof", pprof.Index)
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)