feat(redis): Support streaming spans #6083
2 issues
find-bugs: Found 2 issues (2 medium)
Medium
Missing exception handling around set_db_data_fn and _set_client_data in async client - `sentry_sdk/integrations/redis/_async_common.py:147-148`
In _sentry_execute_command, the calls to set_db_data_fn(db_span, self) and _set_client_data(db_span, is_cluster, name, *args) are not wrapped in capture_internal_exceptions(). The synchronous counterpart in _sync_common.py wraps these calls (lines 147-149). If these functions raise an exception, it will propagate and could cause the Redis command to fail or leave spans unclosed, affecting user operations.
Test assertion checks wrong span index - always passes trivially - `tests/integrations/redis/test_redis_cache_module_async.py:293`
Line 293 asserts "cache.hit" not in spans[1]["data"] but spans[1] is a db.redis span (confirmed at line 286), not the cache.put span being tested. The surrounding assertions (lines 288-294) are testing properties of spans[2] (the cache.put span), but this one accidentally references spans[1]. This makes the assertion trivially pass since db.redis spans never have cache.hit, defeating the intended test that cache.put operations shouldn't set cache.hit.
Also found at:
tests/integrations/redis/test_redis_cache_module.py:330
Duration: 4m 17s · Tokens: 3.8M in / 42.0k out · Cost: $6.60 (+extraction: $0.01, +merge: $0.00, +fix_gate: $0.01)
Annotations
Check warning on line 148 in sentry_sdk/integrations/redis/_async_common.py
sentry-warden / warden: find-bugs
Missing exception handling around set_db_data_fn and _set_client_data in async client
In `_sentry_execute_command`, the calls to `set_db_data_fn(db_span, self)` and `_set_client_data(db_span, is_cluster, name, *args)` are not wrapped in `capture_internal_exceptions()`. The synchronous counterpart in `_sync_common.py` wraps these calls (lines 147-149). If these functions raise an exception, it will propagate and could cause the Redis command to fail or leave spans unclosed, affecting user operations.
Check warning on line 293 in tests/integrations/redis/test_redis_cache_module_async.py
sentry-warden / warden: find-bugs
Test assertion checks wrong span index - always passes trivially
Line 293 asserts `"cache.hit" not in spans[1]["data"]` but spans[1] is a `db.redis` span (confirmed at line 286), not the `cache.put` span being tested. The surrounding assertions (lines 288-294) are testing properties of `spans[2]` (the cache.put span), but this one accidentally references `spans[1]`. This makes the assertion trivially pass since db.redis spans never have cache.hit, defeating the intended test that cache.put operations shouldn't set cache.hit.
Check warning on line 330 in tests/integrations/redis/test_redis_cache_module.py
sentry-warden / warden: find-bugs
[GMZ-5WD] Test assertion checks wrong span index - always passes trivially (additional location)
Line 293 asserts `"cache.hit" not in spans[1]["data"]` but spans[1] is a `db.redis` span (confirmed at line 286), not the `cache.put` span being tested. The surrounding assertions (lines 288-294) are testing properties of `spans[2]` (the cache.put span), but this one accidentally references `spans[1]`. This makes the assertion trivially pass since db.redis spans never have cache.hit, defeating the intended test that cache.put operations shouldn't set cache.hit.