mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-31 16:37:26 -08:00
Merge pull request #3146 from prometheus/fixprofpath
web: fix profile paths
This commit is contained in:
commit
9b4c3d4254
28
web/web.go
28
web/web.go
|
@ -246,19 +246,23 @@ func serveDebug(w http.ResponseWriter, req *http.Request) {
|
||||||
ctx := req.Context()
|
ctx := req.Context()
|
||||||
subpath := route.Param(ctx, "subpath")
|
subpath := route.Param(ctx, "subpath")
|
||||||
|
|
||||||
// Based off paths from init() in golang.org/src/net/http/pprof/pprof.go
|
if !strings.HasPrefix(subpath, "/pprof/") {
|
||||||
if subpath == "/pprof/" {
|
|
||||||
pprof.Index(w, req)
|
|
||||||
} else if subpath == "/pprof/cmdline" {
|
|
||||||
pprof.Cmdline(w, req)
|
|
||||||
} else if subpath == "/pprof/profile" {
|
|
||||||
pprof.Profile(w, req)
|
|
||||||
} else if subpath == "/pprof/symbol" {
|
|
||||||
pprof.Symbol(w, req)
|
|
||||||
} else if subpath == "/pprof/trace" {
|
|
||||||
pprof.Trace(w, req)
|
|
||||||
} else {
|
|
||||||
http.NotFound(w, req)
|
http.NotFound(w, req)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
subpath = strings.TrimPrefix(subpath, "/pprof/")
|
||||||
|
|
||||||
|
switch subpath {
|
||||||
|
case "cmdline":
|
||||||
|
pprof.Cmdline(w, req)
|
||||||
|
case "profile":
|
||||||
|
pprof.Profile(w, req)
|
||||||
|
case "symbol":
|
||||||
|
pprof.Symbol(w, req)
|
||||||
|
case "trace":
|
||||||
|
pprof.Trace(w, req)
|
||||||
|
default:
|
||||||
|
pprof.Index(w, req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue