GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Read only the priority and parent id from a lower-priority W3C tracestate by dougqh · Pull Request #13650 · DataDog/dd-trace-java

Conversation

@dougqh

@dougqh dougqh commented Nov 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What Does This Do

When a W3C trace context is merged into a context a higher-priority style already extracted (Datadog, in the default datadog,tracecontext,baggage order), the merge now reads only the sampling priority (s:) and last parent id (p:) from the tracestate's dd member, and skips that member's other elements.

Stacked on #13610.

Motivation

The merge uses only those two elements: the higher-priority context has its own Datadog tags. On a Kafka consumer receiving records from a Datadog producer (which writes both styles), merging the W3C context is the largest remaining extraction cost, and most of that was parsing the rest of the dd member.

Additional Notes

  • The rule: whichever style comes first in the configured order wins, and a malformed part of a lower-priority one is ignored.

  • Unchanged: every tracestate member is still validated, so a malformed tracestate is still ignored as a whole. s: and p: are validated as before. Inject is untouched.

  • Changed: a malformed element the merge doesn't use (a bad t.tid or t.dm) in the lower-priority dd member no longer discards that tracestate, or its priority and parent id.

  • Golden (CompoundExtractionGoldenTest): 24 of 1274 cases change, all of that kind. All of them have Datadog headers matching the trace, a valid traceparent, and a lower-priority tracestate with t.tid:zzz or t.dm:bad. Injected headers are identical in all 24. What differs:

    • the carried tracestate is kept (it was dropped);
    • when the parent ids differ, the reparented span's _dd.parent_id is the tracestate's p: instead of the Datadog parent id.
  • Only buildForMerge uses this parse, which runs only when merging into a higher-priority context. The full parse (parseForMerge) is unchanged.

  • Numbers: W3CMergeParseBenchmark (added here), on the tracestate a Datadog producer writes, local JDK 21 run:

    parse ns/op
    full merge parse (Check tracestate members in one pass and skip t.* keys the merge never reads #13610) 223.8 ± 14.7
    lower-priority merge parse (this PR) 122.8 ± 1.3

    For reference, before Check tracestate members in one pass and skip t.* keys the merge never reads #13610 the full merge parse was ~388 ns. On a 5-vCPU Linux Xeon (2 forks), the lower-priority parse was 0.53–0.62× the full one.

  • End to end (KafkaFetchedHeadersBenchmark, the same change on the Kafka stack without Check tracestate members in one pass and skip t.* keys the merge never reads #13610, stacked on Merge a W3C trace context from the header cache without running its interpreter #13651; same Linux machine, each variant run twice, interleaved, 5 forks per run; medians of 10 forks): a further −5% to −10% per record on every shape vs Merge a W3C trace context from the header cache without running its interpreter #13651, e.g. fetchedAccessor 4419 → 4182 ns (−5.4%) at appHeaders=0 and 4608 → 4286 ns (−7.0%) at 3. Together with Merge a W3C trace context from the header cache without running its interpreter #13651, about −10% vs Hand parse-only Kafka header values to extraction as views #13620 on that shape.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dougqh @claude
Read only the priority and parent id from a lower-priority tracestate…
41c61a9
…'s dd member

When a higher-priority style (Datadog, by default) has extracted the context, a
W3C trace context is merged into it, and the merge uses only the sampling
priority and last parent id of the tracestate's dd member: the context has its
own Datadog tags. The merge's parse still checked the member's other elements,
and a malformed trace id or decision maker tag there discarded the tracestate,
or its priority and parent id.

The merge now reads only the s: and p: elements, each validated as before, and
skips the others. Every member is still validated, so a malformed tracestate is
still ignored as a whole. Whichever style comes first in the configured order
wins, and a malformed part of a lower-priority one is ignored.

The compound extraction golden changes in exactly those cases (24 of 1274):
the lower-priority tracestate is carried, and a reparented span's last parent is
its p: rather than the Datadog parent id. Injected headers are unchanged in all
of them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dougqh dougqh added comp: core Tracer core tag: performance Performance related changes tag: ai generated Largely based on code generated by an AI or LLM labels Nov 23, 2026
@dougqh dougqh mentioned this pull request Nov 23, 2026
Merge a W3C trace context from the header cache without running its interpreter #13651
Draft
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Nov 23, 2026 •
edited by datadog-prod-us1-4 Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 81.82%
• Overall Coverage: 59.87% (-0.04%)

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dd-octo-sts

dd-octo-sts Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.06 s 13.94 s [+0.1%; +1.7%] (maybe worse)
startup:insecure-bank:tracing:Agent 12.93 s 12.96 s [-0.9%; +0.5%] (no difference)
startup:petclinic:appsec:Agent 17.77 s 17.58 s [+0.3%; +1.9%] (maybe worse)
startup:petclinic:iast:Agent 17.55 s 17.70 s [-1.8%; +0.0%] (no difference)
startup:petclinic:profiling:Agent 17.35 s 17.09 s [+0.6%; +2.4%] (maybe worse)
startup:petclinic:sca:Agent 17.77 s 17.54 s [+0.4%; +2.2%] (maybe worse)
startup:petclinic:tracing:Agent 16.78 s 16.74 s [-0.9%; +1.4%] (no difference)

Commit: 41c61a99 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 24, 2026
Inject an unchanged trace's extracted x-datadog-tags as it arrived #13662
Draft
Check an inherited ot member's consistency once, not on every write #13664
Draft
Write the injecting span's id into tracestate without formatting a String #13669
Draft

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: performance Performance related changes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dougqh
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.