Skip to content

fix(tracer): drop dd= list-entries over 256 bytes from incoming tracestate#4721

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
mtoff/tracestate-max
May 5, 2026
Merged

fix(tracer): drop dd= list-entries over 256 bytes from incoming tracestate#4721
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
mtoff/tracestate-max

Conversation

@mtoffl01

@mtoffl01 mtoffl01 commented May 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

During extraction, parseTracestate drops any dd= list-entry from the incoming tracestate header whose length exceeds 256 bytes, mirroring the cap already enforced on inject. The entry is excluded from both the parsed fields and the propagating tag stored on the SpanContext. Other vendors' list-entries are preserved.

Also adds a tracestateDDMaxSize constant and switches the existing inject-side literal to reference it.

This PR also modifies existing behavior: the prior loop iterated through every dd= list-entry it found (a quirk whose purpose wasn't clear), whereas now encountering an oversized dd= list-entry halts further parsing, so any later dd= list-entries are not considered. Multi-dd= headers are invalid per W3C anyway.

Motivation

Inject already caps the dd= list-entry; extract had no equivalent ceiling.

@mtoffl01
mtoffl01 requested review from a team as code owners May 4, 2026 18:55
@codecov

codecov Bot commented May 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.10%. Comparing base (df8d054) to head (8326d73).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ddtrace/tracer/textmap.go 91.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/textmap.go 84.36% <91.66%> (ø)

... and 450 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-2

datadog-datadog-prod-us1-2 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: 91.67%
Overall Coverage: 61.39% (+3.88%)

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

@mtoffl01
mtoffl01 marked this pull request as draft May 4, 2026 19:04
@mtoffl01
mtoffl01 force-pushed the mtoff/tracestate-max branch from c349c8c to 2c953d3 Compare May 4, 2026 19:31
@mtoffl01 mtoffl01 changed the title fix(tracer): cap tracestate header at 512 bytes on inject and extract fix(tracer): drop oversized dd= entry from incoming tracestate May 4, 2026
@mtoffl01
mtoffl01 force-pushed the mtoff/tracestate-max branch from 2c953d3 to 42fb0c0 Compare May 4, 2026 19:35
@mtoffl01 mtoffl01 changed the title fix(tracer): drop oversized dd= entry from incoming tracestate fix(tracer): drop dd= list-entries over 512 bytes from incoming tracestate May 4, 2026
@mtoffl01
mtoffl01 force-pushed the mtoff/tracestate-max branch from 42fb0c0 to 678063c Compare May 4, 2026 19:37
@mtoffl01 mtoffl01 changed the title fix(tracer): drop dd= list-entries over 512 bytes from incoming tracestate fix(tracer): drop dd= list-entries over 256 bytes from incoming tracestate May 4, 2026
@mtoffl01
mtoffl01 force-pushed the mtoff/tracestate-max branch 2 times, most recently from b145180 to c5e14f5 Compare May 4, 2026 19:50
…state

During extraction, parseTracestate drops any dd= list-entry whose length
exceeds 256 bytes, mirroring the cap already enforced on inject. The entry
is excluded from both the parsed fields and the propagating tag stored on
the SpanContext. Other vendors' list-entries are preserved. Adds a
tracestateDDMaxSize constant and switches the existing inject literal to
reference it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@mtoffl01
mtoffl01 force-pushed the mtoff/tracestate-max branch from c5e14f5 to 0b8c0c7 Compare May 4, 2026 20:07
@mtoffl01
mtoffl01 marked this pull request as ready for review May 4, 2026 20:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b8c0c71b3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ddtrace/tracer/textmap.go Outdated

@bm1549 bm1549 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.

LGTM pending review from a dd-trace-go expert

…check

Per W3C list-member syntax, optional whitespace is allowed around each
list-entry. Without per-entry trim, an oversized entry like " dd=..." did
not match the dd= prefix check, so the size cap was skipped and the entry
was stored as a propagating tag. Trim each entry before the prefix and
length check in both the parse loop and the cleanup-rebuild loop.

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 21:59:35

Comparing candidate commit 8326d73 in PR branch mtoff/tracestate-max with baseline commit df8d054 in branch main.

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

@mtoffl01

mtoffl01 commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

/remove

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented May 5, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-05-05 01:01:28 UTC ℹ️ Start processing command /remove


2026-05-05 01:01:30 UTC ℹ️ Devflow: /remove

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 86c0f03 into main May 5, 2026
225 of 226 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the mtoff/tracestate-max branch May 5, 2026 13:10
darccio pushed a commit that referenced this pull request May 5, 2026
…state (#4721)

### What does this PR do?

During extraction, `parseTracestate` drops any `dd=` list-entry from the incoming tracestate header whose length exceeds 256 bytes, mirroring the cap already enforced on inject. The entry is excluded from both the parsed fields and the propagating tag stored on the SpanContext. Other vendors' list-entries are preserved.

Also adds a `tracestateDDMaxSize` constant and switches the existing inject-side literal to reference it.

This PR also modifies existing behavior: the prior loop iterated through every `dd=` list-entry it found (a quirk whose purpose wasn't clear), whereas now encountering an oversized `dd=` list-entry halts further parsing, so any later `dd=` list-entries are not considered. Multi-`dd=` headers are invalid per W3C anyway.

### Motivation

Inject already caps the `dd=` list-entry; extract had no equivalent ceiling.

Co-authored-by: brian.marks <[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