fix(tracing): Skip child span creation in streaming path when no current span (databases)#6808
Open
sentrivana wants to merge 3 commits into
Open
fix(tracing): Skip child span creation in streaming path when no current span (databases)#6808sentrivana wants to merge 3 commits into
sentrivana wants to merge 3 commits into
Conversation
…ent span (databases) When span streaming is enabled and there is no current span, database 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: aiomysql, asyncpg, clickhouse_driver, pymongo, redis. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Codecov Results 📊✅ 91200 passed | ⏭️ 6302 skipped | Total: 97502 | Pass Rate: 93.54% | Execution Time: 319m 7s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 93.48%. Project has 2434 uncovered lines. Files with missing lines (3)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 89.77% 89.82% +0.05%
==========================================
Files 193 193 —
Lines 23898 23913 +15
Branches 8258 8276 +18
==========================================
+ Hits 21454 21479 +25
- Misses 2444 2434 -10
- Partials 1353 1354 +1Generated by Codecov Action |
The early return for the no-current-span guard was skipping breadcrumb creation in the asyncpg and aiomysql connect wrappers. Move breadcrumb addition before the guard so breadcrumbs are always recorded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Same issue as asyncpg/aiomysql — the no-current-span guard was skipping breadcrumb creation. Move breadcrumb and data computation before the guard. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sentry_sdk.traces.get_current_span() is Noneguard before creating spans in the streaming pathPart of #6819