feat(sqlalchemy): Support span streaming #6132
4 issues
code-review: Found 4 issues (1 high, 3 low)
High
Breaking API change: render_span_tree signature change breaks existing callers - `tests/conftest.py:479`
The render_span_tree fixture signature changed from inner(event) (accepting a full transaction event dict) to inner(spans, root_span=None) (accepting a spans list). Existing callers in test_basic.py (lines 460, 599, 957, 1037, etc.) pass a full event dict like render_span_tree(transaction) which will now be incorrectly interpreted as a spans list, causing iteration over dict keys instead of spans and runtime errors.
Low
Debug print statement left in test fixture - `tests/conftest.py:487`
A print(span) statement was added for debugging purposes but should be removed before merging. Debug print statements in test fixtures can clutter test output and indicate incomplete cleanup before PR submission.
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 the static branch (lines 203-204) also asserts SPANDATA.SERVER_ADDRESS not in span["data"]. This test coverage gap means the span streaming path doesn't verify that SERVER_ADDRESS is absent, potentially masking a behavioral difference between the two modes.
Also found at:
tests/integrations/sqlalchemy/test_sqlalchemy.py:293
Dead code: inner span_streaming else-branch never executes in if-block - `tests/integrations/sqlalchemy/test_sqlalchemy.py:931-933`
Inside the if span_streaming: block (line 901), the fake_record_sql_queries class contains an if span_streaming: check (lines 928-933). Since we're already inside the outer if span_streaming: block, span_streaming is always True, making lines 931-933 (else: self.span.start_timestamp = ...) dead code that will never execute.
Also found at:
tests/integrations/sqlalchemy/test_sqlalchemy.py:989-991
Duration: 8m 20s · Tokens: 2.5M in / 32.6k out · Cost: $3.42 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.01)
Annotations
Check failure on line 479 in tests/conftest.py
sentry-warden / warden: code-review
Breaking API change: render_span_tree signature change breaks existing callers
The `render_span_tree` fixture signature changed from `inner(event)` (accepting a full transaction event dict) to `inner(spans, root_span=None)` (accepting a spans list). Existing callers in `test_basic.py` (lines 460, 599, 957, 1037, etc.) pass a full event dict like `render_span_tree(transaction)` which will now be incorrectly interpreted as a spans list, causing iteration over dict keys instead of spans and runtime errors.