ref(graphene): Simplify span creation #5648
2 issues
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.
Span error status not set when GraphQL operation raises exception - `sentry_sdk/integrations/graphene.py:155`
The __exit__(None, None, None) call always passes None for exception info regardless of whether an exception occurred during the GraphQL operation. 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 value is always None, exceptions during GraphQL operations will not mark the span as errored. This causes incorrect telemetry where failed operations appear successful.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 48.0s | $0.19 |
| find-bugs | 1 | 1m 5s | $0.27 |
| skill-scanner | 0 | 20.1s | $0.03 |
| security-review | 0 | 18.7s | $0.03 |
Duration: 2m 32s · Tokens: 408.9k in / 5.8k out · Cost: $0.53 (+fix_gate: $0.01, +extraction: $0.00, +dedup: $0.00)