Skip to content

ref(graphene): Simplify span creation

da6bc1f
Select commit
Loading
Failed to load commit list.
Merged

ref(graphene): Simplify span creation #5648

ref(graphene): Simplify span creation
da6bc1f
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Mar 12, 2026 in 51s

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

See this annotation in the file changed.

@sentry-warden 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.