ref: Support outgoing trace propagation in span first (18) #5638
2 issues
High
AttributeError when set_span_errored is called on NoOpStreamedSpan - `sentry_sdk/tracing_utils.py:1122`
When set_span_errored is called on a NoOpStreamedSpan, accessing span._segment at line 1122 will raise an AttributeError. NoOpStreamedSpan.__init__ (traces.py:538-548) does not call the parent StreamedSpan.__init__, so the _segment slot attribute is never initialized. Since _segment is defined in StreamedSpan.__slots__, accessing it without initialization raises AttributeError: '_segment'.
Medium
AttributeError when set_span_errored is called on NoOpStreamedSpan - `sentry_sdk/tracing_utils.py:1122-1123`
The set_span_errored function checks isinstance(span, StreamedSpan) which is True for NoOpStreamedSpan instances since it inherits from StreamedSpan. However, NoOpStreamedSpan.__init__ does not call super().__init__() and does not initialize the _segment attribute. When set_span_errored accesses span._segment, it will raise an AttributeError for NoOpStreamedSpan instances. This can occur when tracing is disabled but the function is still called.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 1 | 6m 42s | $6.06 |
| find-bugs | 1 | 13m 6s | $14.16 |
| skill-scanner | 0 | 12m 20s | $1.96 |
| security-review | 0 | 15m | $2.46 |
Duration: 47m 8s · Tokens: 18.3M in / 162.8k out · Cost: $24.69 (+extraction: $0.01, +fix_gate: $0.01, +dedup: $0.04)