feat(sqlalchemy): Support span streaming #6132
3 issues
find-bugs: Found 3 issues (1 medium, 2 low)
Medium
render_span_tree may crash if no root span found in streamed spans - `tests/conftest.py:508`
When root_span=None and no span in spans lacks a parent_span_id, the root_span variable will remain None. The subsequent call to render_span(root_span) at line 508 will fail with a TypeError when attempting to access span["attributes"] or span["span_id"] on None. While valid span data should always include a root span, edge cases or corrupted data could trigger this crash.
Low
Debug print statement left in test fixture - `tests/conftest.py:486`
Line 486 contains print(span) which appears to be a leftover debug statement. This will output debugging information to stdout during test execution, potentially cluttering test output and making it harder to read test results.
Missing SERVER_ADDRESS assertion in span_streaming test branch - `tests/integrations/sqlalchemy/test_sqlalchemy.py:162`
In test_transactions, the span_streaming branch (line 162) only asserts SPANDATA.SERVER_PORT not in span["attributes"] but is missing the assertion for SPANDATA.SERVER_ADDRESS not in span["attributes"]. The non-span_streaming branch (lines 203-204) correctly asserts both are absent. This is an asymmetry in test coverage between the two modes that could mask a regression where SERVER_ADDRESS is incorrectly set for SQLite in-memory databases.
Also found at:
tests/integrations/sqlalchemy/test_sqlalchemy.py:293
Duration: 11m 25s · Tokens: 5.6M in / 53.1k out · Cost: $8.51 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.01)
Annotations
Check warning on line 508 in tests/conftest.py
sentry-warden / warden: find-bugs
render_span_tree may crash if no root span found in streamed spans
When `root_span=None` and no span in `spans` lacks a `parent_span_id`, the `root_span` variable will remain `None`. The subsequent call to `render_span(root_span)` at line 508 will fail with a `TypeError` when attempting to access `span["attributes"]` or `span["span_id"]` on `None`. While valid span data should always include a root span, edge cases or corrupted data could trigger this crash.