Skip to content

Skip whitespace-padded entries in W3C tracestate dd value - #360

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
dd/apms-20291-fix-w3c-tracestate-cpp-202608251606
Nov 5, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
dd/apms-20291-fix-w3c-tracestate-cpp-202608251606

Conversation

@bm1549

@bm1549 bm1549 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Skip dd tracestate entries whose key has leading or trailing whitespace, such as t.x:y or baz :bam. Before, these did not match a known key, so they were kept as unknown entries and injected downstream as-is.

Motivation

system-tests' test_headers_tracestate_dd_skips_malformed_elements says padded keys like z:w are malformed and should be skipped. We passed the test but still forwarded them.

Trailing spaces in values are kept: every tracer's encoder emits them and none drop them on extract.

Additional Notes

This PR originally fixed OWS around tracestate list members too, but #354 already fixed that (in 2.3.0).

An earlier revision checked the whole entry for padding. That dropped tags whose value ends in a space, which our own encoder can produce, so the check now looks at the key only.

Tests:

  • extraction drops entries with padded keys and keeps the rest of the dd value
  • extraction keeps trailing spaces in origin and trace tag values
  • inject after extract drops padded keys and round-trips values that end in a space

References

Jira ticket: APMS-20291

Contributor Checklist

  • I am the author of this pull request and I own it.
  • I reviewed every line of this pull request.
  • This pull request follows the Contributing Guidelines.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

View session in Datadog

Bits Code status: ✅ Done

Comment @DataDog to request changes

@bm1549
bm1549 requested review from a team as code owners August 25, 2026 16:08
@bm1549 bm1549 added the Bits AI label Aug 25, 2026
@datadog-datadog-us1-prod

Copy link
Copy Markdown

I can only run on private repositories.

@bm1549
bm1549 marked this pull request as draft August 25, 2026 16:10
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Pipelines

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

@pr-commenter

pr-commenter Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-05 15:05:27

Comparing candidate commit d91a1b0 in PR branch dd/apms-20291-fix-w3c-tracestate-cpp-202608251606 with baseline commit be1ce6f in branch main.

📊 Benchmarking dashboard

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

@MilanGarnier

Copy link
Copy Markdown
Contributor

@bm1549 I merged yesterday a PR which slightly changed the way the tracestate was being parsed and generated, it might be cleaner (and easier) to regenerate a fix from the newer branch.

bm1549 added a commit that referenced this pull request Aug 28, 2026
@bm1549 bm1549 added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Aug 28, 2026
@bm1549 bm1549 changed the title APMS-20291 Fix W3C tracestate parsing Fix W3C tracestate parsing Aug 28, 2026
@xlamorlette-datadog
xlamorlette-datadog removed their request for review September 3, 2026 09:13
Comment thread test/test_span.cpp Resolved
@xlamorlette-datadog xlamorlette-datadog removed AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos Bits AI labels Nov 3, 2026
@xlamorlette-datadog

Copy link
Copy Markdown
Collaborator

@bm1549 This PR has been in draft state since its creation on August 25, the referenced ticket, APMS-20291: Datadog W3C propagation warning has been done since August 31, and it was suggested that this PR be reworked after #354. Please, do you plan to continue working on this PR, or should we archive it?

An entry such as "  t.x:y" in the dd value did not match a known key,
so it was kept as an unknown entry and injected downstream as-is.
Skip padded entries instead, like other malformed entries. The rest of
the dd value is still used.

APMS-20291
@bm1549
bm1549 force-pushed the dd/apms-20291-fix-w3c-tracestate-cpp-202608251606 branch from 6a84a5e to 55f1838 Compare November 4, 2026 15:11
@bm1549 bm1549 added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Nov 4, 2026
@bm1549 bm1549 changed the title Fix W3C tracestate parsing Skip whitespace-padded entries in W3C tracestate dd value Nov 4, 2026
@bm1549

bm1549 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@xlamorlette-datadog Reworked this. #354 already fixed the OWS issue it targeted, so it is now just skipping whitespace-padded dd entries, in line with test_headers_tracestate_dd_skips_malformed_elements.

@bm1549
bm1549 marked this pull request as ready for review November 4, 2026 15:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T15:37:09.094270Z 55f1838 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-04T15:38:37.551480Z 55f1838 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 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.

Bits Code Review: PASS

More details

Whitespace-padded dd subentries are skipped individually while valid entries and existing tracestate list-member whitespace handling are preserved. The completed static review identified no reportable defects.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 55f1838

Comment thread src/datadog/w3c_propagation.cpp Resolved
The encoder keeps spaces in origin and trace tag values, so an entry
such as "t.foo:bar ;" is valid output of this library. Checking the
whole entry for padding dropped such tags on extraction. Check the key
only, so values keep their spaces.
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 63849d6 into main Nov 5, 2026
40 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the dd/apms-20291-fix-w3c-tracestate-cpp-202608251606 branch November 5, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants