File tree Expand file tree Collapse file tree
instrumentation/datadog-aws-lambda/src/span_inferrer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,20 +196,15 @@ pub(crate) struct TriggerExtraction {
196196/// the ambient context rather than accidentally creating a span parented to trace ID 0.
197197pub ( crate ) fn extract_trigger ( inferrer : & SpanInferrer , payload : & str ) -> TriggerExtraction {
198198 let result = inferrer. infer_span ( payload) . unwrap_or_default ( ) ;
199+ let trace_id = result. carrier . get ( "x-datadog-trace-id" ) . map ( String :: as_str) ;
200+ let has_upstream_trace = trace_id
201+ . and_then ( |id| id. parse :: < u64 > ( ) . ok ( ) )
202+ . is_some_and ( |id| id != 0 ) ;
199203
200204 let upstream_cx = global:: get_text_map_propagator ( |p| {
201- if result
202- . carrier
203- . get ( "x-datadog-trace-id" )
204- . and_then ( |id| id. parse :: < u64 > ( ) . ok ( ) )
205- . is_some_and ( |id| id != 0 )
206- {
205+ if has_upstream_trace {
207206 tracing:: debug!(
208- trace_id = result
209- . carrier
210- . get( "x-datadog-trace-id" )
211- . map( String :: as_str)
212- . unwrap_or( "?" ) ,
207+ trace_id = trace_id. unwrap_or( "?" ) ,
213208 "extracted trace context from trigger"
214209 ) ;
215210 p. extract ( & result. carrier )
You can’t perform that action at this time.
0 commit comments