-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add HTTP pprof endpoints #5363
base: main
Are you sure you want to change the base?
Conversation
8be838e
to
616316f
Compare
Signed-off-by: Leandro López (inkel) <[email protected]>
Signed-off-by: Leandro López (inkel) <[email protected]>
616316f
to
ba44664
Compare
Hi @inkel, I know this PR is still in draft, but I thought I would take a quick look, as it seems interesting. Don't forget to update the server configuration and API docs: https://github.com/runatlantis/atlantis/blob/main/runatlantis.io/docs/server-configuration.md and https://github.com/runatlantis/atlantis/blob/main/runatlantis.io/docs/api-endpoints.md I was also wondering whether |
Thanks @X-Guardian! Yeah, we are running a custom version with this enabled and I wanted to be sure that It Works™ before submitting for final review. So far it only exposes the endpoints from
Thank you! Will do.
🤔 that's a good question. I don't seem these endpoints as an API, as you can only fetch information from them, but I'm open to be convinced otherwise 😬 |
Your call with the profiling packages. If you want to get this one over the line first, that's fine. Do any of these profiling packages have any performance impact if the endpoint isn't being actively read? We are trying to avoid adding unnecessary extra server options, so if there is no performance impact, maybe we should just always have the endpoint enabled... |
🤔 another great question. I don't think they add much overhead, but let me ask around. |
@X-Guardian asking some of my coworkers who are more knowledgeable about this, and the impact is around 1% of the performance. They also mentioned me that getting profiles for memory, block, and mutex can turn costly in some cases, and that's why it is suggested to use this package instead for those profiles. While I like the idea of having these endpoints always enabled is appealing and would make the PR smaller, it perhaps warrants to leave it behind a flag and gather some real world usage data and then decide if removing the flag or not. WDYT? |
Another reason to have this behind a flag is a security concern if you like, as they will expose information about your application. So I think that settles: better behind a flag. |
OK, I still think |
what
This PR adds a new
--enable-profiling-routes
flag that when true will mount thenet/http/pprof
endpoints, allowing to perform continuous profiling on the running server. This will allow a deeper inspection on how the application behaves, where the most CPU and memory is consumed, and so on. See profiling Go programs for additional information.why
At Grafana Labs we use Atlantis with a large number of environments (740+) and when making a change that affects too many environments we have experienced slowness or OOM kills. We would like to make use of Grafana Pyroscope to investigate why this happens and hopefully contribute back.
tests
Added flag test.