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

proposal: net/http/pprof: add parameter for sampling frequency for CPU profiles #57488

Open
florianl opened this issue Dec 28, 2022 · 2 comments
Labels
Milestone

Comments

@florianl
Copy link
Contributor

This proposal is based on #42502 and adds the ability to configure the sampling rate for CPU profiles.

At the moment it is possible to dynamically collect CPU profiles using the net/http/pprof package via go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30. In this example a 30 second CPU profile is collected.
Internally this call utilizes pprof.StartCPUProfile() which uses a hard coded sampling frequency of 100hz.

With #42502 being accepted it would be great if dynamically collected CPU profiles would also get the option to set the sampling frequency. This could be possible by adding an additional parameter besides seconds like hertz. hertz is just used as an example and input on better naming is always welcomed. This new parameter should be optional and if not set the CPU profile should use the default sampling rate of 100hz.

In the following example a CPU profile of 30 seconds with a sampling rate of 257hz is collected:
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30&hertz=257

@gopherbot gopherbot added this to the Proposal milestone Dec 28, 2022
@mastertheknife
Copy link

I would also like to see this. 100 samples/second are not enough for some applications.

@EbenezerJesuraj
Copy link

EbenezerJesuraj commented Feb 28, 2023

In my organization we are running multiple-micro services in a golang-based scaffold,I can clearly see such a feature be very important in debugging and in analyzing the efficiency of such services in specific architecture.. Looking forward to see how this proposal will develop in the forth-coming stages..

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

No branches or pull requests

4 participants