Repository navigation
Conversation
…'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 <noreply@anthropic.com>
Contributor
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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,baggageorder), the merge now reads only the sampling priority (s:) and last parent id (p:) from thetracestate'sddmember, 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
ddmember.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
tracestatemember is still validated, so a malformedtracestateis still ignored as a whole.s:andp:are validated as before. Inject is untouched.Changed: a malformed element the merge doesn't use (a bad
t.tidort.dm) in the lower-priorityddmember no longer discards thattracestate, 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 validtraceparent, and a lower-prioritytracestatewitht.tid:zzzort.dm:bad. Injected headers are identical in all 24. What differs:tracestateis kept (it was dropped);_dd.parent_idis thetracestate'sp:instead of the Datadog parent id.Only
buildForMergeuses this parse, which runs only when merging into a higher-priority context. The full parse (parseForMerge) is unchanged.Numbers:
W3CMergeParseBenchmark(added here), on thetracestatea Datadog producer writes, local JDK 21 run: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.fetchedAccessor4419 → 4182 ns (−5.4%) atappHeaders=0and 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