Repository navigation
Conversation
A forwarded trace whose propagation tags didn't change still had its x-datadog-tags rebuilt tag by tag on every injection: the header cache is per trace and the injection path never read it, so a trace injected once (one per Kafka record) always paid the full encode. Extraction now seeds the Datadog header cache with the raw value when every member was kept as written: nothing dropped (non-_dd.p keys, upstream services, rejected keys), no repeated known key, no zero trace source, no trailing separator. The seed is keyed on the starting sampling state, so any decision or other change discards it as before. The injection path's headerValue overload now reads and fills that cache when there is no parent-id override. The forwarded header keeps the sender's member order, which may differ from ours (for example _dd.p.tid before _dd.p.dm): the members are the same. Tests that asserted our order for unchanged traces now expect the sender's, and the compound extraction golden changes in 132 cases, all order-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 was referenced Nov 24, 2026
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
Injects a forwarded trace's extracted
x-datadog-tagsvalue as it arrived, instead of rebuilding it tag by tag, while nothing about the trace's propagation tags has changed._dd.pkeys,_dd.p.upstream_services, rejected keys), no known key repeats, there is no zero trace source and no trailing separator.headerValueoverload now reads that cache when there's no parent-id override, and fills it after encoding. A second injection of the same trace (several outbound calls) no longer re-encodes either.Motivation
The header cache is per trace, and the Datadog injector called an overload that never read it. So a trace injected once, as in a Kafka consume → produce enricher (one trace per record), always paid the full encode. This is the first half of the inject "passthrough" from the Kafka per-record cost work. The second half, splicing the new parent id into the extracted
tracestate, follows in a separate PR. The Kafka profile puts most of the inject cost there.Behavior change
An unchanged forwarded trace now sends the sender's member order, which can differ from the order we encode in (for example
_dd.p.tidbefore_dd.p.dm). The members are the same. Tests that asserted our order on unchanged traces now expect the sender's. The compound extraction golden changes in 132 of 1,274 cases, and I checked that all 132 are order-only.Results
PropagationTagsBenchmark.extractInjectHeader(Datadog → Datadog,_dd.p.anytag=value,_dd.p.dm=934086a686-4), 2 forks × 5 iterations:In whole-request benchmarks the saving is below the noise:
HeaderPathBenchmarkdatadog: −144 B/op of about 7.1 KB.PropagationScenariosBenchmark.intermediate: within ±90 B of about 4 KB.End to end (Kafka enricher, 10% sampling, 5 rotated reps): a combined build with #13662 and #13664 on the 4i roll-up cuts tracer cost per record from 3.53 to 3.36 µs at 1g (+3.5% throughput) and from 4.89 to 4.70 µs at 96m (+3.2%); 4j beat 4i in 8 of 10 paired reps. The two PRs were measured together, so this is their combined effect. The consumer, which doesn't inject, is flat (2.56 vs 2.58 µs at 1g).
Additional Notes
XDatadogTagsPassthroughTestcovers verbatim headers (including another SDK's member order), each case that must fall back to encoding, and a decision change discarding the seed.XDatadogTagsPassthroughInjectionTestcovers the real extract → child span → inject path with Datadog-only headers, both formats, and both with an otel member.🤖 Generated with Claude Code