feat(pymongo): Add span streaming support#6253
Open
ericapisani wants to merge 3 commits into
Open
Conversation
Add span streaming support to the PyMongo integration, mirroring the pattern used in the asyncpg integration. When trace_lifecycle=stream is enabled, spans are emitted using the new StreamedSpan API with OTel-style attributes. The legacy code path is preserved for non-streaming clients. Fixes PY-2349 Fixes #6047
Member
Author
|
bugbot run |
Member
Author
|
@sentry review |
Contributor
Codecov Results 📊✅ 146 passed | Total: 146 | Pass Rate: 100% | Execution Time: 22.27s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 6.67%. Project has 14358 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 34.96% 34.94% -0.02%
==========================================
Files 190 190 —
Lines 22052 22069 +17
Branches 7408 7420 +12
==========================================
+ Hits 7709 7711 +2
- Misses 14343 14358 +15
- Partials 807 807 —Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b8ddc07. Configure here.
ericapisani
commented
May 11, 2026
|
|
||
| data: "Dict[str, Any]" = {"operation_ids": {}} | ||
| data["operation_ids"]["operation"] = event.operation_id | ||
| data["operation_ids"]["request"] = event.request_id |
Member
Author
There was a problem hiding this comment.
These are also kept for legacy reasons, are being removed for streamed spans.
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.

Add span streaming support to the PyMongo integration. The legacy code path is preserved unchanged for non-streaming clients.
Fixes PY-2349
Fixes #6047