mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #66813 from DylanBLE/pprof
Automatic merge from submit-queue (batch tested with PRs 59030, 64666, 66251, 66485, 66813). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. fix apiserver pprof redirect bug **What this PR does / why we need it**: fix apiserver pprof redirect bug **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #66812 **Special notes for your reviewer**: **Release note**: ```release-note None ```
This commit is contained in:
commit
6afd783dd9
@ -28,9 +28,16 @@ type Profiling struct{}
|
||||
|
||||
// Install adds the Profiling webservice to the given mux.
|
||||
func (d Profiling) Install(c *mux.PathRecorderMux) {
|
||||
c.UnlistedHandle("/debug/pprof", http.HandlerFunc(pprof.Index))
|
||||
c.UnlistedHandleFunc("/debug/pprof", redirectTo("/debug/pprof/"))
|
||||
c.UnlistedHandlePrefix("/debug/pprof/", http.HandlerFunc(pprof.Index))
|
||||
c.UnlistedHandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
c.UnlistedHandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
c.UnlistedHandleFunc("/debug/pprof/trace", pprof.Trace)
|
||||
}
|
||||
|
||||
// redirectTo redirects request to a certain destination.
|
||||
func redirectTo(to string) func(http.ResponseWriter, *http.Request) {
|
||||
return func(rw http.ResponseWriter, req *http.Request) {
|
||||
http.Redirect(rw, req, to, http.StatusFound)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user