Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions sentry_sdk/tracing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,26 +444,23 @@ def __init__(
@classmethod
def from_incoming_data(cls, incoming_data):
# type: (Dict[str, Any]) -> Optional[PropagationContext]
propagation_context = None

normalized_data = normalize_incoming_data(incoming_data)

sentry_trace_header = normalized_data.get(SENTRY_TRACE_HEADER_NAME)
sentrytrace_data = extract_sentrytrace_data(sentry_trace_header)
if sentrytrace_data is None:
return None

propagation_context = PropagationContext()
propagation_context.update(sentrytrace_data)

baggage_header = normalized_data.get(BAGGAGE_HEADER_NAME)
if baggage_header:
propagation_context = PropagationContext()
propagation_context.dynamic_sampling_context = Baggage.from_incoming_header(
baggage_header
).dynamic_sampling_context()

sentry_trace_header = normalized_data.get(SENTRY_TRACE_HEADER_NAME)
if sentry_trace_header:
sentrytrace_data = extract_sentrytrace_data(sentry_trace_header)
if sentrytrace_data is not None:
if propagation_context is None:
propagation_context = PropagationContext()
propagation_context.update(sentrytrace_data)

if propagation_context is not None:
propagation_context._fill_sample_rand()
propagation_context._fill_sample_rand()

return propagation_context

Expand Down