feat(asgi): Migrate away from event processor in span first #5920
1 issue
find-bugs: Found 1 issue (1 medium)
Medium
Custom span names may be unconditionally overwritten for StreamedSpan - `sentry_sdk/integrations/asgi.py:369-371`
The finally block at lines 369-371 unconditionally sets the span name and source from _get_segment_name_and_source() without checking if a custom name/source was already set by the application (e.g., via set_transaction_name()). This contrasts with the event_processor method (lines 385-400) which has an already_set check that respects custom sources (COMPONENT, ROUTE, CUSTOM). This could cause applications that set custom transaction names to have them overwritten with URL-derived names.
Duration: 7m 43s · Tokens: 3.8M in / 26.4k out · Cost: $5.61 (+extraction: $0.00, +fix_gate: $0.00)
Annotations
Check warning on line 371 in sentry_sdk/integrations/asgi.py
sentry-warden / warden: find-bugs
Custom span names may be unconditionally overwritten for StreamedSpan
The finally block at lines 369-371 unconditionally sets the span name and source from `_get_segment_name_and_source()` without checking if a custom name/source was already set by the application (e.g., via `set_transaction_name()`). This contrasts with the `event_processor` method (lines 385-400) which has an `already_set` check that respects custom sources (COMPONENT, ROUTE, CUSTOM). This could cause applications that set custom transaction names to have them overwritten with URL-derived names.