@@ -444,26 +444,23 @@ def __init__(
444444 @classmethod
445445 def from_incoming_data (cls , incoming_data ):
446446 # type: (Dict[str, Any]) -> Optional[PropagationContext]
447- propagation_context = None
448-
449447 normalized_data = normalize_incoming_data (incoming_data )
448+
449+ sentry_trace_header = normalized_data .get (SENTRY_TRACE_HEADER_NAME )
450+ sentrytrace_data = extract_sentrytrace_data (sentry_trace_header )
451+ if sentrytrace_data is None :
452+ return None
453+
454+ propagation_context = PropagationContext ()
455+ propagation_context .update (sentrytrace_data )
456+
450457 baggage_header = normalized_data .get (BAGGAGE_HEADER_NAME )
451458 if baggage_header :
452- propagation_context = PropagationContext ()
453459 propagation_context .dynamic_sampling_context = Baggage .from_incoming_header (
454460 baggage_header
455461 ).dynamic_sampling_context ()
456462
457- sentry_trace_header = normalized_data .get (SENTRY_TRACE_HEADER_NAME )
458- if sentry_trace_header :
459- sentrytrace_data = extract_sentrytrace_data (sentry_trace_header )
460- if sentrytrace_data is not None :
461- if propagation_context is None :
462- propagation_context = PropagationContext ()
463- propagation_context .update (sentrytrace_data )
464-
465- if propagation_context is not None :
466- propagation_context ._fill_sample_rand ()
463+ propagation_context ._fill_sample_rand ()
467464
468465 return propagation_context
469466
0 commit comments