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

add pprof support #693

Merged
merged 4 commits into from
Mar 7, 2024
Merged

add pprof support #693

merged 4 commits into from
Mar 7, 2024

Conversation

flavio
Copy link
Member

@flavio flavio commented Mar 7, 2024

Allow CPU profiling using pprof. There's a new boolean flag --enable-pprof that exposes a new HTTP endpoint named /debug/pprof/cpu.

By doing a GET request against the endpoint, a pprof profile is generated and downloaded.

The endpoint takes two optional query parameters:

  • interval: the length in seconds of the profile (30 secs by default)
  • frequency: profiling frequency (99 Hz by default)

While working on this feature, I found some issues related with cli flags:

  • fix: show cli options sorted
  • fix: improve handling of boolan flags
  • test: test parsing of boolean flags

flavio added 4 commits March 5, 2024 18:43
Sort the cli options when the `--help` command is used

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Bool flags seems to have been broken by a clap upgrade, meaning they
required an argument to be provided in order to work.

Moreover, this PR removes the `--enable-verification` flag, which was no
longer used by the code.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Allow CPU profiling using pprof. There's a new boolean flag
`--enable-pprof` that exposes a new HTTP endpoint named
`/debug/pprof/cpu`.

By doing a GET request against the endpoint, a pprof profile is
generated and downloaded.

The endpoint takes two optional query parameters:

- interval: the length in seconds of the profile (30 secs by default)
- frequency: profiling frequency (99 Hz by default)

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Avoid regressions when handling boolean flags

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@flavio flavio requested a review from a team as a code owner March 7, 2024 14:21
@flavio flavio self-assigned this Mar 7, 2024
@flavio flavio merged commit f347084 into kubewarden:main Mar 7, 2024
9 checks passed
@flavio flavio deleted the add-pprof-support branch March 7, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants