Skip to content

Preserve baggage for automatic Sentry events - #147

Merged
vrslev merged 2 commits into
mainfrom
bugfix/VA-7612-sentry-baggage-snapshot
Aug 27, 2026
Merged

vrslev merged 2 commits into
mainfrom
bugfix/VA-7612-sentry-baggage-snapshot

Conversation

@vrslev

@vrslev vrslev commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • snapshot configured OpenTelemetry baggage on escaping exceptions before baggage scopes detach
  • enrich later automatic Sentry events from the exception snapshot and remove stale configured fields
  • traverse causes, contexts, nested ExceptionGroup children, and cycles
  • preserve innermost nested-scope values without leaking caught or concurrent exceptions
  • require no service-level capture_exception or asyncio integration workaround

Verification

  • just lint-ci
  • just test: 216 passed, 99% coverage
  • real Sentry Excepthook + asyncio.TaskGroup probe: one automatic ExceptionGroup event retained conversation_id without capture_exception
  • sentry-sdk 2.7.0 compatibility probe
  • concurrent FastStream, nested-scope, delayed-capture, chain, cycle, and ExceptionGroup regressions
  • fresh independent review: no material findings

Jira VA-7612

@codecov

codecov Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 99.00% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...obootstrap/instruments/opentelemetry_instrument.py 98.63% <100.00%> (+0.04%) ⬆️
microbootstrap/instruments/sentry_instrument.py 98.57% <100.00%> (+0.87%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vrslev vrslev changed the title VA-7612 Preserve baggage for automatic Sentry events Preserve baggage for automatic Sentry events Aug 26, 2026
@vrslev

vrslev commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Agent:

Closing this draft. The service-level conversation scopes will bind configured baggage to the existing request/message Sentry isolation scope, so automatic framework and logging capture does not need exception snapshots or explicit capture_exception.

@vrslev vrslev closed this Aug 26, 2026
@vrslev vrslev reopened this Aug 27, 2026
@vrslev
vrslev marked this pull request as ready for review August 27, 2026 09:20
@vrslev

vrslev commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Agent:

Reopening after verifying the real Back TaskGroup lifecycle. Automatic top-level Sentry capture receives an ExceptionGroup, so the generic snapshot lookup must traverse nested exceptions. The added regression and real Excepthook probe pass without service-level capture_exception or enable_asyncio_integration.

@vrslev
vrslev merged commit ee87983 into main Aug 27, 2026
18 checks passed
@vrslev
vrslev deleted the bugfix/VA-7612-sentry-baggage-snapshot branch August 27, 2026 09:23
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.

1 participant