Skip to content

Merge branch 'master' into ivana/migrate-event-processors-in-span-first

a07cb19
Select commit
Loading
Failed to load commit list.
Closed

feat: Add enrichers for attribute-based telemetry #5725

Merge branch 'master' into ivana/migrate-event-processors-in-span-first
a07cb19
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Mar 20, 2026 in 4m 26s

3 issues

find-bugs: Found 3 issues (2 high, 1 low)

High

Missing parentheses causes AttributeError: get_attributes is a method, not a property - `sentry_sdk/integrations/asgi.py:394`

Line 394 uses segment.get_attributes.get("sentry.span.source") but get_attributes is a method on StreamedSpan (defined in traces.py line 403) that must be called with parentheses to return the attributes dictionary. Without parentheses, .get() is being called on the method object itself, which will raise AttributeError: 'method' object has no attribute 'get'. This will cause the enricher to fail at runtime when processing spans.

Null check for segment occurs after segment is accessed, causing potential AttributeError - `sentry_sdk/integrations/asgi.py:393-404`

Line 394 accesses segment.get_attributes before the null check on line 395-397 (segment is not None). If telemetry.segment were ever None, line 394 would raise AttributeError: 'NoneType' object has no attribute 'get_attributes' before the null check executes. The check should happen before accessing segment's attributes. While current StreamedSpan implementation always sets _segment to a non-None value, this is a defensive programming issue that could cause crashes if the implementation changes.

Low

_run_enrichers returns None but type annotation doesn't include Optional - `sentry_sdk/scope.py:1874`

The _run_enrichers method has return type annotation Union[Log, Metric, StreamedSpan] but implicitly returns None (bare return on line 1874) when telemetry is not a StreamedSpan. This type mismatch means static type checkers will not catch potential bugs where callers expect a non-None return value.


Duration: 4m 18s · Tokens: 4.6M in / 29.4k out · Cost: $7.40 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.01)

Annotations

Check failure on line 394 in sentry_sdk/integrations/asgi.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

Missing parentheses causes AttributeError: get_attributes is a method, not a property

Line 394 uses `segment.get_attributes.get("sentry.span.source")` but `get_attributes` is a method on `StreamedSpan` (defined in traces.py line 403) that must be called with parentheses to return the attributes dictionary. Without parentheses, `.get()` is being called on the method object itself, which will raise `AttributeError: 'method' object has no attribute 'get'`. This will cause the enricher to fail at runtime when processing spans.

Check failure on line 404 in sentry_sdk/integrations/asgi.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

Null check for segment occurs after segment is accessed, causing potential AttributeError

Line 394 accesses `segment.get_attributes` before the null check on line 395-397 (`segment is not None`). If `telemetry.segment` were ever `None`, line 394 would raise `AttributeError: 'NoneType' object has no attribute 'get_attributes'` before the null check executes. The check should happen before accessing segment's attributes. While current StreamedSpan implementation always sets `_segment` to a non-None value, this is a defensive programming issue that could cause crashes if the implementation changes.