Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

enable pprof #1039

wants to merge 3 commits into from

Conversation

jrwren
Copy link

@jrwren jrwren commented Aug 15, 2023

Description

enable pprof for #1038

Type of Change

  • New Feature

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests

@jrwren jrwren requested a review from a team as a code owner August 15, 2023 15:02
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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@bartam1 bartam1 Aug 15, 2023

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))

@jrwren jrwren requested a review from bartam1 August 18, 2023 14:45
main.go Outdated
@@ -139,6 +143,14 @@ func main() {
os.Exit(1)
}

if enableprofile {
mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index))
Copy link
Contributor

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants