Skip to content

feat(controller): enable pprof profiling support#3769

Merged
zachaller merged 3 commits intoargoproj:masterfrom
johnmwood:add-profiling
Aug 13, 2024
Merged

feat(controller): enable pprof profiling support#3769
zachaller merged 3 commits intoargoproj:masterfrom
johnmwood:add-profiling

Conversation

@johnmwood
Copy link
Copy Markdown
Contributor

This PR enables pprof profiling on the Argo Rollouts controller via the --enable-pprof flag.

Issue: #3757

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

Signed-off-by: John Wood <jmw.home@gmail.com>
Comment thread cmd/rollouts-controller/main.go Outdated
command.Flags().IntVar(&klogLevel, "kloglevel", 0, "Set the klog logging level")
command.Flags().IntVar(&metricsPort, "metricsport", controller.DefaultMetricsPort, "Set the port the metrics endpoint should be exposed over")
command.Flags().IntVar(&healthzPort, "healthzPort", controller.DefaultHealthzPort, "Set the port the healthz endpoint should be exposed over")
command.Flags().IntVar(&pprofPort, "pprof-port", controller.DefaultPProfPort, "Set the port the pprof endpoint should be exposed over")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In my mind as a user, I would like to be able to overwrite the port in case I'm using the default debug port 6060 elsewhere. I will defer on a maintainer's judgement for what pattern makes the most sense in the project given this is creating two flags for one feature.

Copy link
Copy Markdown
Collaborator

@zachaller zachaller Aug 5, 2024

Choose a reason for hiding this comment

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

I am kind of a fan of passing in a single flag of such that we can do 0.0.0.0:6060, :6060 or localhost:6062 . The main reason for this is not all pods can you exec into etc and it might be nice to be a be able to remotely pull pprof files if configured to do so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In terms of wording, a boolean is much easier to convey --enable-pprof=true vs. --pprof-port being the boolean toggle and the config for the address. Do you have any ideas on how we can convey that?

I see two options with tradeoffs:

  1. Having --pprof-port resolve to an address doesn't make it clear that this is disabled by default (maybe the help text is what we need to clarify here).
  2. Setting --enable-pprof equal to an address instead of a boolean feels strange to me. Maybe something like --enable-pprof-server-address is a (verbose) happy medium?

Copy link
Copy Markdown
Collaborator

@zachaller zachaller Aug 5, 2024

Choose a reason for hiding this comment

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

Yea, thats hard. We could stick with the status quo with the code base and be a little less secure which uses 0.0.0.0 by default and then just have the enable and port flag.

I don't like the above due to the security concerns around the data available on the pprof endpoints. So with that said, I think let's go verbos with --enable-pprof-server-address or --enable-pprof-address I think I am impartial on weather server is there or not, thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with both. I think the latter is more simple so I will probably go with that. Give me a moment and I can put in some changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I pushed up a commit to consolidate the two config vars. My remaining question is what you want to do about the default value? We obviously don't want to enable profiling for every user so I don't know know a way around "" as the default unless you have suggestions?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What you did for default is perfect, this LGTM thanks for adding this.

Comment thread controller/controller.go Outdated
Comment thread controller/profiling.go
Signed-off-by: John Wood <jmw.home@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 5, 2024

Published E2E Test Results

  4 files    4 suites   3h 29m 17s ⏱️
112 tests  99 ✅  7 💤  6 ❌
460 runs  421 ✅ 28 💤 11 ❌

For more details on these failures, see this check.

Results for commit 691ab58.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 5, 2024

Published Unit Test Results

2 257 tests   2 257 ✅  2m 58s ⏱️
  128 suites      0 💤
    1 files        0 ❌

Results for commit 691ab58.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 5, 2024

Codecov Report

Attention: Patch coverage is 15.38462% with 11 lines in your changes missing coverage. Please review.

Project coverage is 83.95%. Comparing base (872f2ac) to head (691ab58).
Report is 80 commits behind head on master.

Files with missing lines Patch % Lines
controller/profiling.go 0.00% 8 Missing ⚠️
cmd/rollouts-controller/main.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3769      +/-   ##
==========================================
+ Coverage   78.19%   83.95%   +5.75%     
==========================================
  Files         157      162       +5     
  Lines       22507    18508    -3999     
==========================================
- Hits        17599    15538    -2061     
+ Misses       3995     2107    -1888     
+ Partials      913      863      -50     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sonarqubecloud
Copy link
Copy Markdown

@zachaller zachaller added this to the v1.8 milestone Aug 13, 2024
@zachaller zachaller merged commit 0397210 into argoproj:master Aug 13, 2024
meeech pushed a commit to CircleCI-Public/argo-rollouts that referenced this pull request Feb 10, 2025
* feat(controller): enable pprof profiling

Signed-off-by: John Wood <jmw.home@gmail.com>

* wip

Signed-off-by: John Wood <jmw.home@gmail.com>

* Consolidate --enable-pprof and --pprof-port into single config variable

Signed-off-by: John Wood <jmw.home@gmail.com>

---------

Signed-off-by: John Wood <jmw.home@gmail.com>
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