Repository navigation
Conversation
Extraction parsed the inherited ot member and checked it against the inherited decision on the request thread, at extraction, compound merge and root span construction, though only W3C injection, OTLP export and a local change of decision read it. Keep the raw member in an InheritedSamplingState and parse it on first read. Consistency checks made before then are recorded as pending and applied in order when it's parsed, so the output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
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
Since #12397, extraction parses the inherited
ottracestate member into anOtelTraceStateand checks it against the inherited decision, all on the request thread. Only W3C injection, OTLP export and a local change of decision ever read it, so a leaf service exporting to the Datadog agent never needs it.This keeps the raw member and parses it on first read:
InheritedSamplingState, alongside Defer building the OpenTelemetry tracestate until it's injected or exported #12982'sProbabilitySamplingState, holds the raw member, its original size and the pending consistency checks. The firstgetOtelTraceState()parses the member, applies the checks, and publishes the result with a CAS. An invalid member resolves tonull, as before.The eager sites now defer:
W3CPTagsCodec.fromHeaderValue)updateW3CTracestateFrom)EXTERNAL_OVERRIDE/UNKNOWNreconcilesThe last one includes root-span construction from an extracted trace (
DDSpanContext.java:453): the extracted priority isn't on thePTagsyet there, so every continued trace was parsing the member at span construction.Local decisions (
forceKeep, manual or AppSec keep) still parse and rewrite the member, as before.Output is unchanged. A check drops
thwhenrv >= thdoesn't match the decision, and dropping it is idempotent and leaves the state consistent with any decision. So any sequence of checks equals one check per decision, in any order, and two bits record them.Motivation
#12981 and #12982 recover #12397's head decision-path cost but none of its extract-side cost, which leaf and intermediate services pay. This applies the deferral model from the TraceSegment design (APMLP-2049) to the
otmember. The larger extract-side change is left to that work.Benchmark
PropagationScenariosBenchmark(added in #12982). Before = #12982; after = this branch. Leaf and intermediate with-f 3,-prof gc.Why the allocation saving is small:
OtelTraceStateis ~64 B.InheritedSamplingStateis ~16 B bigger thanSamplingState.The snapshots, not the parsed object, dominate the extract-side cost. Shrinking
InheritedSamplingState(one field for raw-or-resolved, packed size and checks) would get closer to −40 B. That's left to the TraceSegment work, which replaces the snapshots instead.Additional Notes
InheritedSamplingStateTest: for 10 kinds ofotmember × all four check combinations, lazy resolution equals parsing first then checking, and check order doesn't matter.InheritedOtelExtractionTest: real compound and OTel-only extraction plus a finished leaf span leaves the member unparsed, and the header output is still correct, including dropping an inconsistentth.dd-trace-coresuite passes, apart from:TracerConnectionReliabilityTestcasesDDAgentWriterCombinedTestandPendingTraceBufferTest, which fail under full-suite load and pass on their own🤖 Generated with Claude Code