feat(tracing): add support for DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT#337
feat(tracing): add support for DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT#337MilanGarnier wants to merge 5 commits into
Conversation
|
BenchmarksBenchmark execution time: 2026-07-08 16:19:56 Comparing candidate commit aed025f in PR branch Found 2 performance improvements and 5 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.
|
7bdf91b to
a8070c3
Compare
Matches the exact output of the config-inversion tool, which the verify CI job diffs against byte-for-byte.
Description
Add support for
DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT, controlling how thetracer handles incoming distributed-trace context on extraction:
continue(default): existing behavior — propagate the extracted contextas-is.
restart: start a brand-new trace (fresh sampling decision, no parent)and attach a span link back to the extracted context, carrying the
extracted W3C
tracestatefor later reference.ignore: discard the incoming context entirely;extract_spanreturnsError::NO_SPAN_TO_EXTRACTand baggage extraction is skipped as well.Changes:
PropagationBehaviorExtractenum + parser(
propagation_behavior_extract.h/.cpp), following the sameparse/to_string_view pattern as
PropagationStyle.TracerConfig/FinalizedTracerConfig,ConfigName,telemetry config reporting, and
supported-configurations.json.DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT(default"continue").Tracer::extract_spanbranches on the configured behavior:short-circuits for
ignore, builds a fresh span + span link forrestart, otherwise behaves as before.ExtractedDatagainstracestate_full(the raw, un-parsed W3Ctracestatestring) so it can be attached to the span link created byrestart.Span::add_linkto build theSpanLinkin one shotinstead of mutating fields after default-construction.
This branch is stacked on
milan.garnier/span-links-support, whichintroduced span-link support end-to-end (required by
restart); this PR'sdiff is scoped to the propagation-behavior-extract feature itself.
Motivation
Matches the behavior already available in other Datadog tracers
(dd-trace-go/py/rb/java) for controlling context propagation on extraction,
letting services opt out of continuing an untrusted/foreign trace context
while still linking back to it for correlation.
Additional Notes
restartlink'sflagsfield is not yet populated (see// TODO: flagsintracer.cpp) — sampling flags for the link should be derivedonce available.
link_attributes["context_headers"]is currently a placeholder(
"todo") and should be filled in with the actual extracted headersbefore merge.
Jira ticket: APMAPI-1941