-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(controller): Fixed broken pprof links #4037
Signed-off-by: Derek Brown <[email protected]>
- Loading branch information
1 parent
c0ca530
commit 322ccd7
Showing
2 changed files
with
8 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
package controller | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"net/http/pprof" | ||
) | ||
|
||
const ( | ||
ProfilingPath = "/debug/pprof" | ||
) | ||
|
||
// NewPProfServer returns a new pprof server to gather runtime profiling data | ||
func NewPProfServer() *http.ServeMux { | ||
mux := http.NewServeMux() | ||
|
||
mux.HandleFunc(ProfilingPath, pprof.Index) | ||
mux.HandleFunc(fmt.Sprintf("%s/cmdline", ProfilingPath), pprof.Cmdline) | ||
mux.HandleFunc(fmt.Sprintf("%s/profile", ProfilingPath), pprof.Profile) | ||
mux.HandleFunc(fmt.Sprintf("%s/symbol", ProfilingPath), pprof.Symbol) | ||
mux.HandleFunc(fmt.Sprintf("%s/trace", ProfilingPath), pprof.Trace) | ||
// TODO: Remove enumerating all pprof endpoints if/when a more ergonomic | ||
// attachment solution is introduced. See: https://github.com/golang/go/issues/71213. | ||
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) | ||
mux.HandleFunc("/debug/pprof/trace/", pprof.Trace) | ||
|
||
return mux | ||
} |