-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable pprof #1039
base: master
Are you sure you want to change the base?
enable pprof #1039
Conversation
main.go
Outdated
@@ -138,6 +140,7 @@ func main() { | |||
setupLog.Error(err, "unable to start manager") | |||
os.Exit(1) | |||
} | |||
mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this like here: https://github.com/kube-logging/logging-operator/blob/8a8a3ec6bd7764653cc049397d253c53b373a2c7/main.go#L158
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we should also add these:
mgr.AddMetricsExtraHandler("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
mgr.AddMetricsExtraHandler("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
mgr.AddMetricsExtraHandler("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
mgr.AddMetricsExtraHandler("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
main.go
Outdated
@@ -139,6 +143,14 @@ func main() { | |||
os.Exit(1) | |||
} | |||
|
|||
if enableprofile { | |||
mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check the returned error here and for the other mgr.AddMetricsExtraHandler cases.
err = mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index))
if err != nil {
setupLog.Error(err, "unable to attach pprof to webserver")
os.Exit(1)
}
Description
enable pprof for #1038
Type of Change
Checklist