ref(graphene): Simplify span creation #5648
1 issue
code-review: Found 1 issue (1 medium)
Medium
Span error status never set when exceptions occur - `sentry_sdk/integrations/graphene.py:155`
The code calls _graphql_span.__exit__(None, None, None) unconditionally in the finally block, which prevents exceptions from being recorded on the span. The Span.__exit__ method checks if value is not None to set SPANSTATUS.INTERNAL_ERROR, but since None is always passed for the exception value, any exceptions raised during GraphQL execution will result in spans without proper error status. This should use sys.exc_info() to pass actual exception information.
Duration: 48.0s · Tokens: 141.5k in / 1.9k out · Cost: $0.19 (+fix_gate: $0.00)
Annotations
Check warning on line 155 in sentry_sdk/integrations/graphene.py
sentry-warden / warden: code-review
Span error status never set when exceptions occur
The code calls `_graphql_span.__exit__(None, None, None)` unconditionally in the finally block, which prevents exceptions from being recorded on the span. The `Span.__exit__` method checks `if value is not None` to set `SPANSTATUS.INTERNAL_ERROR`, but since `None` is always passed for the exception value, any exceptions raised during GraphQL execution will result in spans without proper error status. This should use `sys.exc_info()` to pass actual exception information.