Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ def continue_from_headers(cls, headers):
parent = cls.from_traceparent(headers.get("sentry-trace"))
if parent is None:
return cls()
return parent.new_span(same_process_as_parent=False)
parent.same_process_as_parent = False
return parent

def iter_headers(self):
# type: () -> Generator[Tuple[str, str], None, None]
Expand Down Expand Up @@ -236,7 +237,7 @@ def from_traceparent(cls, traceparent):
else:
sampled = None

return cls(trace_id=trace_id, span_id=span_id, sampled=sampled)
return cls(trace_id=trace_id, parent_span_id=span_id, sampled=sampled)

def to_traceparent(self):
# type: () -> str
Expand Down
3 changes: 3 additions & 0 deletions tests/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def test_continue_from_headers(sentry_init, capture_events, sampled):
assert span is not None
assert span.sampled == sampled
assert span.trace_id == old_span.trace_id
assert span.same_process_as_parent is False
assert span.parent_span_id == old_span.span_id
assert span.span_id != old_span.span_id

with Hub.current.start_span(span):
with Hub.current.configure_scope() as scope:
Expand Down