Skip to content

Commit ad97a1c

Browse files
authored
fix(propagation): add tracestate to datadog context (#27)
# What does this PR do? _If the tracecontext propagator is configured, even if it is not the first propagator to extract the trace context, the tracestate will be saved in the local trace context if the traceparent trace-id matches the extracted the trace-id._ At the moment, only the `tracestate` tag was set. This PR sets also primary_context tracestate property in the datadog's extracted context. # Additional Notes It will fix some ST from [test_headers_preference.py](https://github.com/DataDog/system-tests/blob/main/tests/parametric/test_headers_precedence.py#L693)
1 parent cc6f2de commit ad97a1c

File tree

1 file changed

+2
-1
lines changed
  • dd-trace-propagation/src

1 file changed

+2
-1
lines changed

dd-trace-propagation/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ impl DatadogCompositePropagator {
127127
primary_context
128128
.tags
129129
.insert(TRACESTATE_KEY.to_string(), tracestate.clone());
130+
primary_context.tracestate = context.tracestate.clone();
130131
}
131132

132133
if primary_context.trace_id == context.trace_id
@@ -616,7 +617,7 @@ pub mod tests {
616617
]),
617618
links: vec![],
618619
is_remote: true,
619-
tracestate: None
620+
tracestate: Some(Tracestate::from_str("dd=s:2;o:rum;t.dm:-4;t.usr.id:baz64,congo=t61rcWkgMzE").unwrap())
620621
}
621622
),
622623
// Tracestate is not added when TraceContext style comes later and does not

0 commit comments

Comments
 (0)