Skip to content

ref(strawberry): Simplify span creation#5647

Merged
sentrivana merged 3 commits into
masterfrom
ivana/fixup-strawberry-integration
Mar 12, 2026
Merged

ref(strawberry): Simplify span creation#5647
sentrivana merged 3 commits into
masterfrom
ivana/fixup-strawberry-integration

.

e28a436
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden completed Mar 12, 2026 in 1m 13s

2 issues

Medium

Span not closed if exception thrown into generator - `sentry_sdk/integrations/strawberry.py:189-204`

The manual __enter__() and __exit__(None, None, None) calls lack exception safety. If an exception is thrown into the generator at the yield point, the code after yield (including __exit__) won't execute, leaving the span unclosed and the scope in an inconsistent state (scope.span still points to this span). Additionally, always passing (None, None, None) to __exit__ means any exception that does reach that code won't be recorded on the span's status.

Exception status not propagated to span when GraphQL operation fails - `sentry_sdk/integrations/strawberry.py:204`

The new code calls self.graphql_span.__exit__(None, None, None) unconditionally, which tells the span that no exception occurred. In the Span.__exit__ method (tracing.py:399-400), exceptions are detected via the value parameter and result in setting the span status to INTERNAL_ERROR. By always passing None, exceptions raised during GraphQL operations will not be reflected in the span's status, losing important error context for observability.

4 skills analyzed
Skill Findings Duration Cost
code-review 1 1m 9s $0.27
find-bugs 1 44.2s $0.26
skill-scanner 0 18.7s $0.07
security-review 0 18.5s $0.07

Duration: 2m 30s · Tokens: 342.7k in / 6.3k out · Cost: $0.67 (+dedup: $0.00)