Skip to content

ref(asyncio): Migrate integration to span-first#6198

Draft
ericapisani wants to merge 2 commits intomasterfrom
py-2304-migrate-asyncio-to-span-first
Draft

ref(asyncio): Migrate integration to span-first#6198
ericapisani wants to merge 2 commits intomasterfrom
py-2304-migrate-asyncio-to-span-first

Conversation

@ericapisani
Copy link
Copy Markdown
Member

@ericapisani ericapisani commented May 4, 2026

Migrates the asyncio integration to support the span-first (streaming) trace lifecycle alongside the existing static transaction-based approach.

The integration now uses StreamedSpan when trace_lifecycle: "stream" is enabled, and falls back to the existing Span-based behavior otherwise. Tests are parametrized to cover both modes.

Fixes PY-2304
Fixes #6002

ericapisani and others added 2 commits May 4, 2026 14:39
Update the asyncio integration to use sentry_sdk.traces.start_span()
when span streaming is enabled, storing op and origin as span
attributes instead of top-level fields.

Add span_streaming parametrization to test_create_task to cover both
the legacy static path and the new streaming path, asserting on
segment and span structure in each mode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 4, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 8.72s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 14956 uncovered lines.
❌ Project coverage is 31.36%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
asyncio.py 0.00% ⚠️ 123 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    31.38%    31.36%    -0.02%
==========================================
  Files          190       190         —
  Lines        21780     21790       +10
  Branches      7294      7298        +4
==========================================
+ Hits          6834      6834         —
- Misses       14946     14956       +10
- Partials       578       578         —

Generated by Codecov Action

@ericapisani
Copy link
Copy Markdown
Member Author

bugbot run

@ericapisani
Copy link
Copy Markdown
Member Author

@sentry review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit cdaa63a. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate asyncio to span first

1 participant