feat(sqlalchemy): Support span streaming #6132
3 issues
find-bugs: Found 3 issues (3 low)
Low
Incorrect type annotation in _handle_error allows StreamedSpan but declares only Span - `sentry_sdk/integrations/sqlalchemy.py:104`
At line 104, the type annotation declares span: "Optional[Span]" but the code at line 107 explicitly handles StreamedSpan instances via isinstance(span, StreamedSpan). This inconsistency could cause static type checkers to flag the isinstance check as always-false, and it misrepresents the actual runtime behavior where _sentry_sql_span can be either Span or StreamedSpan.
Also found at:
sentry_sdk/tracing_utils.py:178
Debug print statement left in test fixture - `tests/conftest.py:486`
A print(span) statement on line 486 appears to be debug code accidentally left in. This will pollute test output by printing every span object during test execution, making test logs noisy and harder to read.
Missing SERVER_ADDRESS assertion in span_streaming path of test_transactions - `tests/integrations/sqlalchemy/test_sqlalchemy.py:162`
The span_streaming path in test_transactions is missing the SPANDATA.SERVER_ADDRESS not in span["attributes"] assertion that exists in the non-streaming path (line 203). The non-streaming path validates both SERVER_ADDRESS and SERVER_PORT are absent from span data, but the streaming path only validates SERVER_PORT. This creates a gap in test coverage where the streaming implementation could incorrectly include SERVER_ADDRESS without test failure.
Also found at:
tests/integrations/sqlalchemy/test_sqlalchemy.py:289-293
Duration: 9m 41s · Tokens: 8.3M in / 61.0k out · Cost: $10.77 (+extraction: $0.01, +merge: $0.00, +fix_gate: $0.01)