feat(tracing): add DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT#3997
Draft
MilanGarnier wants to merge 7 commits into
Draft
feat(tracing): add DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT#3997MilanGarnier wants to merge 7 commits into
MilanGarnier wants to merge 7 commits into
Conversation
|
Adds the new `DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT` config key (values: continue, restart, ignore) with a CUSTOM(INT) parser, the corresponding C enum, and the supported-configurations.json entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds three behaviors at the single extraction chokepoint (ddtrace_apply_distributed_tracing_result): - continue (default): inherit upstream trace context unchanged - restart: start a fresh trace; upstream captured as a span link with reason=propagation_behavior_extract. When the root span doesn't exist yet at request-init time, the link is queued in DDTRACE_G(pending_upstream_span_link) and attached in ddtrace_open_span. - ignore: drop all extracted context including baggage and sampling priority Also extracts ddtrace_build_span_link_from_result() from the SpanLink fromHeaders method so it can be reused by the restart path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers the three behaviors (continue, restart, ignore) and config parsing (case-insensitive values, invalid value falls back to default). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6b7e259 to
3ca8428
Compare
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.
Summary
Implements
DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT(APMAPI-1941, feature-parity #353) for the PHP tracer, matching behavior already present in .NET, Python, Node, Java, Ruby, and Rust.Three values:
continue(default): inherit upstream trace context unchanged — no behavior changerestart: start a fresh trace; the upstream context is captured as a span link withreason=propagation_behavior_extractignore: drop all extracted context including baggage and sampling priorityDesign:
ddtrace_apply_distributed_tracing_resultindistributed_tracing_headers.c, covering both request-init andconsume_distributed_tracing_headersuserland callsrestartpath: when the root span doesn't yet exist at request-init time, the span link is queued inDDTRACE_G(pending_upstream_span_link)and consumed inddtrace_open_spanwhen the root span is createdddtrace_build_span_link_from_result()fromSpanLink::fromHeadersfor reuseTest plan
tests/ext/distributed_tracing/propagation_behavior_extract_continue.phpt— verifies trace_id inherited, no span link, baggage preservedtests/ext/distributed_tracing/propagation_behavior_extract_restart.phpt— verifies fresh trace_id, span link with correct upstream ids and reason, baggage preserved,_dd.p.*not in link attributestests/ext/distributed_tracing/propagation_behavior_extract_ignore.phpt— verifies fresh trace_id, no span link, baggage dropped, sampling priority droppedtests/ext/distributed_tracing/propagation_behavior_extract_config.phpt— verifies case-insensitive parsing, invalid value falls back tocontinueRelated
🤖 Generated with Claude Code