Skip to content

Commit bc8bf63

Browse files
committed
more warden stuff
1 parent 8d0b013 commit bc8bf63

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

sentry_sdk/integrations/celery/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def _inner(*args: "Any", **kwargs: "Any") -> "Any":
321321
scope.add_event_processor(_make_event_processor(task, *args, **kwargs))
322322

323323
transaction: "Optional[Union[Span, StreamedSpan]]" = None
324-
span_ctx: "Union[Span, StreamedSpan]"
324+
span_ctx: "Optional[Union[Span, StreamedSpan]]" = None
325325

326326
# Celery task objects are not a thing to be trusted. Even
327327
# something such as attribute access can fail.
@@ -359,7 +359,7 @@ def _inner(*args: "Any", **kwargs: "Any") -> "Any":
359359
},
360360
)
361361

362-
if transaction is None:
362+
if transaction is None or span_ctx is None:
363363
return f(*args, **kwargs)
364364

365365
with span_ctx:

sentry_sdk/integrations/strawberry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ def on_parse(self) -> "Generator[None, None, None]":
260260
if isinstance(self.graphql_span, StreamedSpan):
261261
self.parsing_span = sentry_sdk.traces.start_span(
262262
name="parsing",
263+
parent_span=self.graphql_span,
263264
)
264265
self.parsing_span.set_op(OP.GRAPHQL_PARSE)
265266
self.parsing_span.set_origin(StrawberryIntegration.origin)

sentry_sdk/scope.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,10 @@ def set_transaction_name(self, name: str, source: "Optional[str]" = None) -> Non
825825
"""Set the transaction name and optionally the transaction source."""
826826
self._transaction = name
827827
if self._span:
828-
if isinstance(self._span, StreamedSpan):
828+
if isinstance(self._span, NoOpStreamedSpan):
829+
return
830+
831+
elif isinstance(self._span, StreamedSpan):
829832
self._span.segment.set_name(name)
830833
if source:
831834
self._span.segment.set_source(source)

0 commit comments

Comments
 (0)