feat: add continuous profiler instrumentation#178
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #178 +/- ##
=======================================
Coverage 65.08% 65.08%
=======================================
Files 76 76
Lines 3993 3993
=======================================
Hits 2599 2599
Misses 1124 1124
Partials 270 270
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
2291890 to
7a1483b
Compare
Add continuous profiling to instrumented applications. The profiler gets basically the default configuration, and is activated at run time by setting the environment variable DD_PROFILING_ENABLED to any of "1", "true", or "auto".
7a1483b to
da7d13d
Compare
RomainMuller
approved these changes
Jul 31, 2024
Signed-off-by: github-actions on behalf of RomainMuller <github-actions@github.com>
felixge
approved these changes
Aug 6, 2024
Member
felixge
left a comment
There was a problem hiding this comment.
Thank you so much 🙇 . This LGTM.
felixge
reviewed
Aug 6, 2024
RomainMuller
approved these changes
Aug 6, 2024
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Aug 6, 2024
PROF-10258 ### What does this PR do? Add profiling, enabled manually by setting `DD_PROFILING_ENABLED=true` at run time. The profiler has roughly the default configuration, with a few non-default profile types which should be low-enough overhead and sufficiently useful to enable for recent Go releases. There are not currently any other configuration knobs. If enabled this way, the profiles will be tagged with `orchestrion:true`. This PR also accepts the value `DD_PROFILING_ENABLED=auto` to enable profiling. This can be provided via the [Datadog Admission Controller](https://docs.datadoghq.com/containers/cluster_agent/admission_controller) (see [this PR](DataDog/datadog-agent#27185)). Some languages/runtimes use heuristics to decide whether to enable profiling when `auto` is provided, to avoid profiling short-lived or non-instrumented applications. We assume the application is meant to be instrumented by virtue of the user building with Orchestrion. And the Go profiler won't send any data until at least one minute has passed. So, we treat `auto` the same as `true`. TODO - document this once it's released TODO - this has only been manually tested. That's probably okay for now; there's not much to this code. But we can investigate ways to automatically test it. ### Motivation If somebody uses Orchestrion to add APM instrumentation, and they also want profiling, Orchestrion should be able to add it so the user doesn't have to separately modify their code to get profiling. ### Reviewer's Checklist <!-- * Authors can use this list as a reference to ensure that there are no problems during the review but the signing off is to be done by the reviewer(s). --> - [ ] Changed code has unit tests for its functionality. --------- Signed-off-by: github-actions on behalf of RomainMuller <github-actions@github.com> Co-authored-by: Romain Marcadier <romain@datadoghq.com> Co-authored-by: github-actions on behalf of RomainMuller <github-actions@github.com> Co-authored-by: Romain Marcadier <romain.muller@telecomnancy.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PROF-10258
What does this PR do?
Add profiling, enabled manually by setting
DD_PROFILING_ENABLED=trueat run time.The profiler has roughly the default configuration, with a few non-default profile types which
should be low-enough overhead and sufficiently useful to enable for recent Go releases.
There are not currently any other configuration knobs.
If enabled this way, the profiles will be tagged with
orchestrion:true.This PR also accepts the value
DD_PROFILING_ENABLED=autoto enable profiling.This can be provided via the Datadog Admission Controller (see this PR).
Some languages/runtimes use heuristics to decide whether to enable profiling when
autois provided, to avoid profiling short-lived or non-instrumented applications.We assume the application is meant to be instrumented by virtue of the user building
with Orchestrion. And the Go profiler won't send any data until at least one minute has
passed. So, we treat
autothe same astrue.TODO - document this once it's released
TODO - this has only been manually tested. That's probably okay for now; there's not
much to this code. But we can investigate ways to automatically test it.
Motivation
If somebody uses Orchestrion to add APM instrumentation, and they also want
profiling, Orchestrion should be able to add it so the user doesn't have to
separately modify their code to get profiling.
Reviewer's Checklist