ref(graphene): Simplify span creation #5648
2 issues
Medium
Span exit ignores exception info, preventing error status from being set - `sentry_sdk/integrations/graphene.py:155`
The __exit__(None, None, None) call in the finally block always passes None for the exception arguments, even when an exception occurs during the yield. The Span.__exit__ method (lines 396-406 in tracing.py) checks if value is not None to set INTERNAL_ERROR status on the span. Since value is always None, GraphQL errors will not be reflected in the span's status.
Low
Exception info not passed to span's __exit__, preventing error status on exceptions - `sentry_sdk/integrations/graphene.py:155`
The finally block calls _graphql_span.__exit__(None, None, None) unconditionally, discarding exception information. The span's __exit__ method checks if value is not None and should_be_treated_as_error(ty, value) to set SPANSTATUS.INTERNAL_ERROR, but since None is always passed, spans won't be marked as errored even when exceptions occur during GraphQL execution. This affects observability when unexpected exceptions propagate.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 1m 45s | $0.44 |
| find-bugs | 1 | 43.8s | $0.20 |
| skill-scanner | 0 | 16.6s | $0.07 |
| security-review | 0 | 18.4s | $0.04 |
Duration: 3m 4s · Tokens: 499.7k in / 6.8k out · Cost: $0.76 (+extraction: $0.00, +dedup: $0.00)