Skip to content

fix(compression): align zstd behavior across targets - #2400

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits into
mainfrom
rochdev/address-compression-review
Aug 25, 2026
Merged

fix(compression): align zstd behavior across targets#2400
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits into
mainfrom
rochdev/address-compression-review

Conversation

@rochdev

@rochdev rochdev commented Aug 24, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Addresses follow-up review feedback from #2386:

  • restores the pre-feat(compression): use zrip for wasm targets #2386 Miri FFI explanation in the profile test helper;
  • documents the WASM and native zstd compression-level contracts;
  • maps level 0 to level 3 on every target;
  • clamps WASM zrip levels to -7..=4 while preserving native zstd's broader range;
  • reports the effective compression level from trace compression;
  • isolates target-specific trace encoder construction and shares the write/finish path; and
  • tests native passthrough and WASM clamping at both boundaries.

Motivation

The zrip WASM backend supports a narrower compression-level range than native zstd and previously assigned a different meaning to level 0. Out-of-range levels also disabled trace compression or failed profile compression under WASM. The target branches duplicated the common encoder flow.

This follows up on these review threads:

Additional Notes

Native targets continue to accept the broader range reported by zstd::compression_level_range(). WASM clamps requested levels to zrip's supported range, so level 22 becomes 4; level 0 becomes 3 on every target.

The full trace-utils integration binary was not validated locally because Docker could not pull the private GHCR test-agent image. All 348 trace-utils library tests passed. Strict trace-utils clippy also reports an existing collapsible_match warning in unchanged tracer_payload.rs; clippy passes with that lint allowed.

This PR was generated by Codex.

How to test the change?

  • cargo test -p libdd-profiling
  • cargo test -p libdd-trace-utils --features compression --lib
  • env CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner cargo test -p libdd-wasm-tests --target wasm32-unknown-unknown
  • cargo +stable clippy -p libdd-profiling --all-targets -- -D warnings
  • cargo +stable clippy -p libdd-wasm-tests --target wasm32-unknown-unknown --all-targets -- -D warnings
  • cargo +stable clippy -p libdd-trace-utils --all-targets --features compression -- -D warnings -A clippy::collapsible_match
  • cargo +nightly-2026-07-26 fmt --all -- --check
  • cargo test -p libdd-profiling --doc
  • cargo test -p libdd-trace-utils --features compression --doc

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 76.63% (-0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e5dc6ef | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Aug 24, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-08-24 18:46:29

Comparing candidate commit e5dc6ef in PR branch rochdev/address-compression-review with baseline commit 394c7e2 in branch main.

Found 1 performance improvements and 1 performance regressions! Performance is the same for 104 metrics, 10 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 ----------------------------------'

scenario:datadog_sample_span/resource_pattern_rule_not_matching/wall_time

  • 🟥 execution_time [+18.729ns; +18.795ns] or [+11.692%; +11.733%]

scenario:glob_matcher/unicode_exact_match/wall_time

  • 🟩 execution_time [-5.699ns; -5.650ns] or [-7.152%; -7.091%]

Candidate

Omitted due to size.

Baseline

Omitted due to size.

@dd-octo-sts

dd-octo-sts Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 89.52 MB 89.52 MB +0% (+8 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.26 MB 8.26 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.06 MB 11.06 MB 0% (0 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 100.70 MB 100.70 MB +0% (+8 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 26.64 MB 26.64 MB +.01% (+4.00 KB) 🔍
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 94.96 KB 94.96 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 180.73 MB 180.75 MB +0% (+16.00 KB) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 772.85 MB 773.55 MB +.08% (+708.91 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.73 MB 8.73 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 94.96 KB 94.96 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 25.65 MB 25.65 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 51.09 MB 51.09 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 23.22 MB 23.22 MB +0% (+512 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 96.45 KB 96.45 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 185.66 MB 185.66 MB -0% (-8.00 KB) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 759.09 MB 759.28 MB +.02% (+198.03 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.74 MB 6.74 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 96.45 KB 96.45 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 27.59 MB 27.59 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 48.62 MB 48.62 MB -0% (-2 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 79.78 MB 79.78 MB 0% (0 B) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 9.16 MB 9.16 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 95.42 MB 95.42 MB 0% (0 B) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.17 MB 11.17 MB 0% (0 B) 👌

@rochdev
rochdev marked this pull request as ready for review August 24, 2026 18:08
@rochdev
rochdev requested review from a team as code owners August 24, 2026 18:08
Comment thread libdd-profiling/src/pprof/test_utils.rs Outdated
@rochdev

rochdev commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 25, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-25 11:59:53 UTC ℹ️ Start processing command /merge


2026-08-25 11:59:59 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 60m (p90).


2026-08-25 12:45:50 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit a25619e into main Aug 25, 2026
108 of 111 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the rochdev/address-compression-review branch August 25, 2026 12:45
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