Skip to content

.

2bf7c77
Select commit
Loading
Failed to load commit list.
Merged

feat(sqlalchemy): Support span streaming #6132

.
2bf7c77
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Apr 24, 2026 in 13m 5s

4 issues

code-review: Found 4 issues (1 medium, 3 low)

Medium

Potential runtime error if no root span found in streamed spans - `tests/conftest.py:508`

When root_span=None (streamed spans mode), the code expects to find a span without parent_span_id in the spans list. If no such span exists (e.g., all spans have a parent_span_id), root_span remains None and render_span(root_span) at line 508 will attempt to access span["attributes"] on None, raising a TypeError. This is a potential edge case that could cause confusing test failures.

Low

Debug print statement left in test fixture - `tests/conftest.py:486`

A print(span) statement at line 486 appears to be debugging code that was accidentally left in the fixture. This will pollute test output with span data on every test run that uses this fixture, making it harder to identify actual test failures and increasing noise in CI logs.

Missing SERVER_ADDRESS assertion in span_streaming branch - `tests/integrations/sqlalchemy/test_sqlalchemy.py:293`

The span_streaming branch asserts that SPANDATA.SERVER_PORT is not in span['attributes'] but omits the SPANDATA.SERVER_ADDRESS assertion that exists in the else branch (line 314). This creates inconsistent test coverage between the two code paths - the non-streaming path verifies that SERVER_ADDRESS is absent when engine.url is None, but the streaming path does not.

Also found at:

  • tests/integrations/sqlalchemy/test_sqlalchemy.py:162
Dead code: span_streaming check always False in else branch - `tests/integrations/sqlalchemy/test_sqlalchemy.py:989-990`

In the else branch (line 962+), the code path is only executed when span_streaming is False. However, the fake_record_sql_queries class defined inside this branch (lines 984-994) still contains a conditional if span_streaming: check that will never be True. This dead code branch (lines 989-990) can never execute, making the conditional unnecessary. While not a runtime error, this indicates the test was likely duplicated from the streaming branch without proper cleanup.


Duration: 12m 59s · Tokens: 4.1M in / 51.9k out · Cost: $5.37 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.01)

Annotations

Check warning on line 508 in tests/conftest.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

Potential runtime error if no root span found in streamed spans

When `root_span=None` (streamed spans mode), the code expects to find a span without `parent_span_id` in the spans list. If no such span exists (e.g., all spans have a `parent_span_id`), `root_span` remains `None` and `render_span(root_span)` at line 508 will attempt to access `span["attributes"]` on `None`, raising a `TypeError`. This is a potential edge case that could cause confusing test failures.