Skip to content

fix(profiler): support gzip compression mode#4696

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
felix.geisendoerfer/fix-profiler-support-gzip-compression-mode
Apr 29, 2026
Merged

fix(profiler): support gzip compression mode#4696
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
felix.geisendoerfer/fix-profiler-support-gzip-compression-mode

Conversation

@felixge

@felixge felixge commented Apr 27, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds a functional gzip compression mode for the profiler via DD_PROFILING_DEBUG_COMPRESSION_SETTINGS=gzip. This was already kinda working, but not really, hence the "fix" title.

  • Defaults gzip to gzip-6, matching the gzip level legacy mode applies when it compresses profiler-produced profiles.
  • Adds gzip-to-gzip recompression so gzip mode works for runtime profiles that are already gzip-compressed at gzip-1.
  • Adds tests for gzip mode and gzip recompression.

See #4697 for some follow-up cleanups.

Motivation

This is done for incident-53386, where zstd caused a memory usage increase. The gzip mode provides an alternative to the default zstd compression while keeping profiler uploads compressed.

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.
  • New code is free of linting errors. You can check this by running make lint locally.
  • New code doesn't break existing tests. You can check this by running make test locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • All generated files are up to date. You can check this by running make generate locally.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running make fix-modules locally.

Tests run:

  • go test ./profiler -run 'TestNewCompressionPipeline|TestDebugCompressionEnv/explicit-gzip' -count=1

Add gzip-to-gzip recompression so DD_PROFILING_DEBUG_COMPRESSION_SETTINGS=gzip works for runtime profiles that are already gzip-compressed. Default gzip mode to gzip-6, matching the compression level legacy mode applies when it compresses profiler-produced profiles.

This is done for incident-53386, where zstd caused a memory usage increase.

Prompts:

> The profiler is using zstd compression by default. It also has a legacy mode. Can you add a gzip mode was well? Outline what needs to be done, ask me questions about anything unclear or complications.

> Are you saying DD_PROFILING_DEBUG_COMPRESSION_SETTINGS=gzip already works?

> Add a test case for the problem and show it failing to me.

> What level of gzip compression does legacy use? make that the default level for "gzip"

> Implement the recompression.

> Do we even need TestDebugCompressionEnv/explicit-gzip-already-gzipped-input ?

> Ok, can you show me that the passthrough mode for the same gzip level works? is that a real case?

> jj commit. say that this is done for incident-53386 where zstd has caused memory usage increase.
@datadog-official

datadog-official Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 82.76%
Overall Coverage: 61.15% (-0.05%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d6b8ffe | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Apr 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.84848% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.86%. Comparing base (749408d) to head (d6b8ffe).

Files with missing lines Patch % Lines
profiler/compression.go 84.84% 3 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
profiler/compression.go 85.07% <84.84%> (-5.22%) ⬇️

... and 275 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@felixge
felixge marked this pull request as ready for review April 27, 2026 07:19
@felixge
felixge requested a review from a team as a code owner April 27, 2026 07:19
Comment thread profiler/compression.go
@pr-commenter

pr-commenter Bot commented Apr 27, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-04-27 08:04:04

Comparing candidate commit d6b8ffe in PR branch felix.geisendoerfer/fix-profiler-support-gzip-compression-mode with baseline commit 749408d in branch main.

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

@nsrip-dd nsrip-dd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@felixge

felixge commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Apr 27, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-04-27 19:13:53 UTC ℹ️ Start processing command /merge


2026-04-27 19:14:02 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-04-27 23:17:09 UTC ⚠️ MergeQueue: This merge request was unqueued

devflow unqueued this merge request: It did not become mergeable within the expected time

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 997e8b2 into main Apr 29, 2026
196 of 197 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the felix.geisendoerfer/fix-profiler-support-gzip-compression-mode branch April 29, 2026 07:06
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Apr 29, 2026
### What does this PR do?

See commits.

### Motivation

Follow-up cleanups to #4696 suggested by my clanker. Separate PR to make the main one easier to review.

### 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 at or near 100% coverage.
- [ ] [System-Tests](https://github.com/DataDog/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.
- [ ] New code is free of linting errors. You can check this by running `make lint` locally.
- [ ] New code doesn't break existing tests. You can check this by running `make test` locally.
- [ ] Add an appropriate team label so this PR gets put in the right place for the release notes.
- [ ] All generated files are up to date. You can check this by running `make generate` locally.
- [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally.

Unsure? Have a question? Request a review!


Co-authored-by: felix.geisendoerfer <[email protected]>
nsrip-dd added a commit that referenced this pull request May 1, 2026
Backport #4696 to the v2.7.x release branch

Adds a functional gzip compression mode for the profiler via
`DD_PROFILING_DEBUG_COMPRESSION_SETTINGS=gzip`. This was already kinda
working, but not really, hence the "fix" title.

- Defaults `gzip` to gzip-6, matching the gzip level legacy mode applies
  when it compresses profiler-produced profiles.
- Adds gzip-to-gzip recompression so gzip mode works for runtime
  profiles that are already gzip-compressed at gzip-1.
- Adds tests for gzip mode and gzip recompression.

This is done for incident-53386, where zstd caused a memory usage
increase. The gzip mode provides an alternative to the default zstd
compression while keeping profiler uploads compressed.

Co-authored-by: Felix Geisendörfer <[email protected]>
darccio pushed a commit that referenced this pull request May 4, 2026
### What does this PR do?

Adds a functional gzip compression mode for the profiler via `DD_PROFILING_DEBUG_COMPRESSION_SETTINGS=gzip`. This was already kinda working, but not really, hence the "fix" title.

- Defaults `gzip` to gzip-6, matching the gzip level legacy mode applies when it compresses profiler-produced profiles.
- Adds gzip-to-gzip recompression so gzip mode works for runtime profiles that are already gzip-compressed at gzip-1.
- Adds tests for gzip mode and gzip recompression.

See #4697 for some follow-up cleanups.

### Motivation

This is done for incident-53386, where zstd caused a memory usage increase. The gzip mode provides an alternative to the default zstd compression while keeping profiler uploads compressed.

### Reviewer's Checklist

- [x] Changed code has unit tests for its functionality at or near 100% coverage.
- [ ] [System-Tests](https://github.com/DataDog/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.
- [ ] New code is free of linting errors. You can check this by running `make lint` locally.
- [x] New code doesn't break existing tests. You can check this by running `make test` locally.
- [ ] Add an appropriate team label so this PR gets put in the right place for the release notes.
- [ ] All generated files are up to date. You can check this by running `make generate` locally.
- [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally.

Tests run:

- `go test ./profiler -run 'TestNewCompressionPipeline|TestDebugCompressionEnv/explicit-gzip' -count=1`


Co-authored-by: felix.geisendoerfer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants