Skip to content

Commit

Permalink
pprof prefix must be '/debug/pprof/' because of golang/go#14286
Browse files Browse the repository at this point in the history
  • Loading branch information
talgendler committed Nov 9, 2020
1 parent c47c69a commit 35ea739
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions handlers/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

const (
internalPatternPrefix = "/internal"
internalPatternPrefix = "/debug"
)

// StatsInfo some statistics information
Expand Down Expand Up @@ -44,7 +44,7 @@ type debugHandlersDeps struct {
// - running stats
func InternalDebugHandlers(deps debugHandlersDeps) []partial.HTTPHandlerPatternPair {
return []partial.HTTPHandlerPatternPair{
{Pattern: internalPatternPrefix + "/debug/vars", Handler: deps.DebugVars()},
{Pattern: internalPatternPrefix + "/vars", Handler: deps.DebugVars()},
{Pattern: internalPatternPrefix + "/dump", Handler: deps.DumpFunc()},
{Pattern: internalPatternPrefix + "/stats", Handler: deps.Stats()},
}
Expand Down
5 changes: 3 additions & 2 deletions handlers/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
)

const (
profilePrefix = internalPatternPrefix + "/debug/pprof"
// the path of pprof must start with /debug/pprof because of https://github.com/golang/go/issues/14286
profilePrefix = internalPatternPrefix + "/pprof"
)

// InternalProfileHandlerFunctions profile handlers
func InternalProfileHandlerFunctions() []partial.HTTPHandlerFuncPatternPair {
return []partial.HTTPHandlerFuncPatternPair{
{Pattern: profilePrefix, HandlerFunc: pprof.Index},
{Pattern: profilePrefix + "/", HandlerFunc: pprof.Index},
{Pattern: profilePrefix + "/cmdline", HandlerFunc: pprof.Cmdline},
{Pattern: profilePrefix + "/profile", HandlerFunc: pprof.Profile},
{Pattern: profilePrefix + "/symbol", HandlerFunc: pprof.Symbol},
Expand Down

0 comments on commit 35ea739

Please sign in to comment.