fix(tracing): Skip child span creation in streaming path when no current span (misc)#6815
fix(tracing): Skip child span creation in streaming path when no current span (misc)#6815sentrivana wants to merge 1 commit into
Conversation
…ent span (misc) When span streaming is enabled and there is no current span, integrations should not create new root segments for child-span operations. This adds a guard check using `sentry_sdk.traces.get_current_span()` before creating spans in the streaming path. Affected integrations: socket, grpc (client), asyncio, mcp, rust_tracing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Results 📊✅ 89129 passed | ❌ 26 failed | ⏭️ 6302 skipped | Total: 95457 | Pass Rate: 93.37% | Execution Time: 301m 39s 📊 Comparison with Base Branch
➕ New Tests (26)View new tests
❌ Failed Tests
|
| File | Patch % | Lines |
|---|---|---|
| sentry_sdk/integrations/mcp.py | 78.26% | |
| sentry_sdk/integrations/socket.py | 50.00% | |
| sentry_sdk/integrations/grpc/aio/client.py | 66.67% | |
| sentry_sdk/integrations/grpc/client.py | 66.67% |
Coverage diff
@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 89.78% 89.44% -0.34%
==========================================
Files 193 193 —
Lines 23898 23921 +23
Branches 8258 8280 +22
==========================================
+ Hits 21454 21394 -60
- Misses 2444 2527 +83
- Partials 1353 1355 +2Generated by Codecov Action
Summary
sentry_sdk.traces.get_current_span() is Noneguard before creating spans in the streaming pathTest plan
🤖 Generated with Claude Code