fix(tracing): fall back to remaining styles in extract-first mode #22221
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 395 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.358
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #22221"
general
weight: 0.35
gnufede
Description
Fixes
DD_TRACE_PROPAGATION_EXTRACT_FIRST=trueinddtrace/propagation/http.pyso HTTP trace context extraction continues checking configured propagation styles in order until one matches, instead of stopping after the first configured style on a miss and returningNone.Minimal reproducer
Root causes and changes
1. Break only on match: Moved
break, telemetry recording, and legacyot-baggage-attachment insideif extracted_context:so a missing or malformed first style falls through to remaining configured styles (tracecontext,b3multi,b3).2. Preserve empty
Context()on miss: Extract into a temporaryextracted_contextbefore assigning tocontextsoHTTPPropagator.extract()returns an emptyContext()rather thanNonewhen no style matches.3. Skip
"baggage"inside the trace loop: Matched the default multi-style path by skipping_PROPAGATION_STYLE_BAGGAGEinside the extract-first loop so W3C baggage stays handled independently afterward (avoiding early exit or duplicate baggage telemetry when"baggage"precedes a trace style).Customer impact
Customers enabling
DD_TRACE_PROPAGATION_EXTRACT_FIRST=truewith multiple propagation styles (including the defaultdatadog,tracecontext,baggage) now preserve distributed traces carried in fallback styles and receive an emptyContext()instead ofNonewhen no trace headers are present. Afixesrelease note is included.Testing
Local validation only (not yet run in CI):
origin/mainbefore the fix.scripts/run-tests -r --venv 4fe876cb327a -- -q -k extract_first(Python 3.12, rebased onmain): 17 passed, covering first-style precedence, skippingtracestatemerge, fallback totracecontext/b3multi/b3and malformed headers, all-styles-miss returningContext(),"baggage"ordering (first/middle/last/only), legacyot-baggage-,DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT=restart/ignore, andDD_TRACE_PROPAGATION_STYLE_EXTRACT=none.scripts/run-tests --venv 4fe876cb327a -- -q -k test_propagation(Python 3.12): 1,809 passed, 1 xfailed; 8 pre-existing 128-bit subprocess tests failed locally only because no agent listens onlocalhost:8126in the localtracersuite.scripts/lint fmt,scripts/lint typing,scripts/lint type-comments-check --base-ref origin/main, andscripts/lint checks: all passed.Risks
Low. Scoped strictly to the
config._propagation_extract_firstbranch inHTTPPropagator.extract; the default (False) extraction path is unchanged.Additional Notes
Release note:
releasenotes/notes/fix-propagation-extract-first-8c51d7cda3330f40.yaml.