dd-trace-go icon indicating copy to clipboard operation
dd-trace-go copied to clipboard

profiler: add FlushAndStop to upload current profiles before exiting

Open jinroh opened this issue 1 year ago • 1 comments

What does this PR do?

This PR adds a new bool env DD_PROFILING_FLUSH_ON_EXIT in order to abort and upload the current profiling sessions before exiting.

Motivation

  • profiling short lived processes without fine-tuning the period
  • profile visibility on the "exit section" of processes and applications

Reviewer's Checklist

  • [ ] Changed code has unit tests for its functionality at or near 100% coverage.
  • [ ] System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • [ ] There is a benchmark for any new code, or changes to existing code.
  • [ ] If this interacts with the agent in a new way, a system test has been added.
  • [ ] Add an appropriate team label so this PR gets put in the right place for the release notes.
  • [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

jinroh avatar Oct 14 '24 14:10 jinroh

Benchmarks

Benchmark execution time: 2024-10-14 15:29:59

Comparing candidate commit b17b58a2002cc91a571fba27e3ed1ab1f4a2ed45 in PR branch jinroh/profiler-flush-and-stop with baseline commit 5b9a8af2b241ec60b990840add9da5799c3c811b in branch main.

Found 1 performance improvements and 0 performance regressions! Performance is the same for 57 metrics, 1 unstable metrics.

scenario:BenchmarkInjectW3C-24

  • 🟩 execution_time [-181.063ns; -146.537ns] or [-4.224%; -3.418%]

pr-commenter[bot] avatar Oct 14 '24 15:10 pr-commenter[bot]