From 322ccd726006d9f21e2d46c949410d6ebc02f4a9 Mon Sep 17 00:00:00 2001 From: Derek Brown <6845676+DerekTBrown@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:48:18 -0800 Subject: [PATCH] fix(controller): Fixed broken pprof links #4037 Signed-off-by: Derek Brown --- USERS.md | 1 + controller/profiling.go | 17 +++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/USERS.md b/USERS.md index 0c7f356bfd..211b65ab32 100644 --- a/USERS.md +++ b/USERS.md @@ -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/) diff --git a/controller/profiling.go b/controller/profiling.go index 03920906ac..cf5af5e60f 100644 --- a/controller/profiling.go +++ b/controller/profiling.go @@ -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 }