Skip to content

Commit 6177d98

Browse files
authored
Merge pull request #2124 from kube-logging/fix/pprof
fix(main): pprof
2 parents 2a21532 + c6594a9 commit 6177d98

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

main.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func main() {
8484
var enableLeaderElection bool
8585
var verboseLogging bool
8686
var loggingOutputFormat string
87-
var enableprofile bool
87+
var enableProfile bool
8888
var namespace string
8989
var loggingRef string
9090
var watchLabeledChildren bool
@@ -100,7 +100,7 @@ func main() {
100100
flag.BoolVar(&verboseLogging, "verbose", false, "Enable verbose logging")
101101
flag.StringVar(&loggingOutputFormat, "output-format", "", "Logging output format (json, console)")
102102
flag.IntVar(&klogLevel, "klogLevel", 0, "Global log level for klog (0-9)")
103-
flag.BoolVar(&enableprofile, "pprof", false, "Enable pprof")
103+
flag.BoolVar(&enableProfile, "pprof", false, "Enable pprof")
104104
flag.StringVar(&namespace, "watch-namespace", "", "Namespace to filter the list of watched objects")
105105
flag.StringVar(&loggingRef, "watch-logging-name", "", "Logging resource name to optionally filter the list of watched objects based on which logging they belong to by checking the app.kubernetes.io/managed-by label")
106106
flag.BoolVar(&watchLabeledChildren, "watch-labeled-children", false, "Only watch child resources with Logging operator's name label selector: app.kubernetes.io/name: fluentd|fluentbit|syslog-ng")
@@ -173,11 +173,14 @@ func main() {
173173
}
174174
}
175175

176-
if enableprofile {
176+
if enableProfile {
177177
setupLog.Info("enabling pprof")
178-
pprofxIndexPath := "/debug/pprof"
179178
customMgrOptions.Metrics.ExtraHandlers = map[string]http.Handler{
180-
pprofxIndexPath: http.HandlerFunc(pprof.Index),
179+
"/debug/pprof/": http.HandlerFunc(pprof.Index),
180+
"/debug/pprof/cmdline": http.HandlerFunc(pprof.Cmdline),
181+
"/debug/pprof/profile": http.HandlerFunc(pprof.Profile),
182+
"/debug/pprof/symbol": http.HandlerFunc(pprof.Symbol),
183+
"/debug/pprof/trace": http.HandlerFunc(pprof.Trace),
181184
}
182185
}
183186

0 commit comments

Comments
 (0)