feat(rq): Support span streaming#6493
2 issues
code-review: Found 2 issues (1 medium, 1 low)
Medium
`job.func_name` accessed without exception guard in streaming span attributes - `sentry_sdk/integrations/rq.py:93`
In the streaming path, job.func_name is accessed unguarded in the start_span attributes dict (line 93) after it was already guarded with capture_internal_exceptions() (line 82). If job.func_name raises an exception, the first access is silently swallowed but the second will propagate unhandled, crashing span creation for the job.
Low
Streaming test does not assert new `messaging.message.id` / `code.function.name` attributes - `tests/integrations/rq/test_rq.py:413-421`
The streaming branch of test_transaction_no_error only asserts sentry.op and span["name"]. The two new span attributes added by this PR in rq.py — SPANDATA.MESSAGING_MESSAGE_ID (set to job.id) and SPANDATA.CODE_FUNCTION_NAME (set to job.func_name) — are the stated purpose of the change but have no assertions. Consider adding checks so a regression that renames or drops either attribute would be caught.
⏱ 4m 9s · 361.8k in / 22.0k out · $0.76
Annotations
Check warning on line 93 in sentry_sdk/integrations/rq.py
sentry-warden / warden: code-review
`job.func_name` accessed without exception guard in streaming span attributes
In the streaming path, `job.func_name` is accessed unguarded in the `start_span` attributes dict (line 93) after it was already guarded with `capture_internal_exceptions()` (line 82). If `job.func_name` raises an exception, the first access is silently swallowed but the second will propagate unhandled, crashing span creation for the job.