Skip to content

fix(tracer): enforce baggage item and byte limits on extraction#4720

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
mtoff/baggage-max-lim
May 4, 2026
Merged

fix(tracer): enforce baggage item and byte limits on extraction#4720
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
mtoff/baggage-max-lim

Conversation

@mtoffl01

@mtoffl01 mtoffl01 commented May 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Applies baggageMaxItems (64) and baggageMaxBytes (8192) when extracting baggage from incoming headers in (*propagatorBaggage).extractTextMap. Once either limit would be breached by the next entry, the remaining entries are dropped.

Motivation

Brings extract-side behavior in line with the existing inject-side enforcement of these same limits.

Apply baggageMaxItems and baggageMaxBytes when extracting baggage from
incoming headers in (*propagatorBaggage).extractTextMap. Items beyond
either limit are dropped. Brings extract-side behavior in line with the
existing inject-side enforcement.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@mtoffl01
mtoffl01 requested review from a team as code owners May 4, 2026 18:21
@codecov

codecov Bot commented May 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.01%. Comparing base (bc4344c) to head (01fa808).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/textmap.go 84.14% <100.00%> (ø)

... and 447 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.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented May 4, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 61.38% (+3.88%)

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

Replace zero-start C-style loops with range-over-int form to satisfy
the modernize/rangeint linter.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Split the combined limit check so we can emit a distinct warning for
the items vs. bytes case when entries are dropped.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@pr-commenter

pr-commenter Bot commented May 4, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-04 19:51:43

Comparing candidate commit b037ef9 in PR branch mtoff/baggage-max-lim with baseline commit bc4344c in branch main.

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

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit ffc33dc into main May 4, 2026
235 of 238 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the mtoff/baggage-max-lim branch May 4, 2026 20:15
darccio pushed a commit that referenced this pull request May 5, 2026
### What does this PR do?

Applies `baggageMaxItems` (64) and `baggageMaxBytes` (8192) when extracting baggage from incoming headers in `(*propagatorBaggage).extractTextMap`. Once either limit would be breached by the next entry, the remaining entries are dropped.

### Motivation

Brings extract-side behavior in line with the existing inject-side enforcement of these same limits.

Co-authored-by: mikayla.toffler <[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.

3 participants