feat(sqlalchemy): Support span streaming #6132
3 issues
code-review: Found 3 issues (1 medium, 2 low)
Medium
Potential runtime error if no root span found in streamed spans - `tests/conftest.py:488-490`
When root_span=None (streaming mode), the code attempts to find a root span by looking for a span without parent_span_id. If no such span exists in the list, root_span remains None, and line 509 will raise a runtime error when calling render_span(root_span). This could cause cryptic test failures.
Also found at:
tests/conftest.py:485-487
Low
Missing SERVER_ADDRESS assertion in span_streaming path of test_transactions - `tests/integrations/sqlalchemy/test_sqlalchemy.py:162`
The span streaming branch of test_transactions only asserts SPANDATA.SERVER_PORT not in span["attributes"], while the non-streaming branch checks both SPANDATA.SERVER_ADDRESS not in span["data"] and SPANDATA.SERVER_PORT not in span["data"]. This asymmetry means the streaming path does not verify SERVER_ADDRESS is absent, reducing test coverage for the span streaming feature.
Also found at:
tests/integrations/sqlalchemy/test_sqlalchemy.py:293
Span streaming test path missing CODE_NAMESPACE assertion - `tests/integrations/sqlalchemy/test_sqlalchemy.py:811-813`
The span streaming branch (lines 811-813) only checks for CODE_LINE_NUMBER, CODE_FILE_PATH, and CODE_FUNCTION_NAME attributes, but omits the CODE_NAMESPACE check that exists in the non-streaming branch (lines 864-867, 871). This asymmetry in test coverage could allow a regression where span streaming mode fails to include namespace information.
Duration: 8m 56s · Tokens: 2.2M in / 26.9k out · Cost: $2.99 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.00)
Annotations
Check warning on line 490 in tests/conftest.py
sentry-warden / warden: code-review
Potential runtime error if no root span found in streamed spans
When `root_span=None` (streaming mode), the code attempts to find a root span by looking for a span without `parent_span_id`. If no such span exists in the list, `root_span` remains `None`, and line 509 will raise a runtime error when calling `render_span(root_span)`. This could cause cryptic test failures.
Check warning on line 487 in tests/conftest.py
sentry-warden / warden: code-review
[B9C-6RJ] Potential runtime error if no root span found in streamed spans (additional location)
When `root_span=None` (streaming mode), the code attempts to find a root span by looking for a span without `parent_span_id`. If no such span exists in the list, `root_span` remains `None`, and line 509 will raise a runtime error when calling `render_span(root_span)`. This could cause cryptic test failures.