Skip to content

Commit

Permalink
fix(controller): Fixed broken pprof links #4037
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Brown <[email protected]>
  • Loading branch information
DerekTBrown committed Jan 9, 2025
1 parent c0ca530 commit 322ccd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Organizations below are **officially** using Argo Rollouts. Please send a PR wit
1. [PagerDuty](https://www.pagerduty.com/)
1. [PayPal](https://www.paypal.com/)
1. [PayPay](https://paypay.ne.jp/)
1. [Plaid](https://plaid.com/)
1. [Priceline](https://priceline.com)
1. [Productboard](https://www.productboard.com)
1. [Quipper](https://www.quipper.com/)
Expand Down
17 changes: 7 additions & 10 deletions controller/profiling.go
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
}

0 comments on commit 322ccd7

Please sign in to comment.