Skip to content

Commit 5f8835b

Browse files
.
1 parent 811b05d commit 5f8835b

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

sentry_sdk/scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ def start_streamed_span(
12781278
if parent_span is _DEFAULT_PARENT_SPAN or isinstance(
12791279
parent_span, NoOpStreamedSpan
12801280
):
1281-
parent_span = self.streamed_span # type: ignore
1281+
parent_span = self.streamed_span
12821282

12831283
# If no eligible parent_span was provided and there is no currently
12841284
# active span, this is a segment

tests/integrations/celery/test_celery.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from celery.bin import worker
88

99
import sentry_sdk
10-
from sentry_sdk import start_transaction, get_current_span
10+
from sentry_sdk import start_transaction, get_current_span, get_current_streamed_span
1111
from sentry_sdk.integrations.celery import (
1212
CeleryIntegration,
1313
_wrap_task_run,
@@ -663,7 +663,11 @@ def test_sentry_propagate_traces_override(span_streaming, init_celery):
663663

664664
@celery.task(name="dummy_task", bind=True)
665665
def dummy_task(self, message):
666-
trace_id = get_current_span().trace_id
666+
trace_id = (
667+
get_current_streamed_span().trace_id
668+
if span_streaming
669+
else get_current_span().trace_id
670+
)
667671
return trace_id
668672

669673
if span_streaming:

0 commit comments

Comments
 (0)