patch
Thanks for your Pull Request 🎉
Please keep these instructions in mind so we can review it more efficiently:
- Issue Ref: -
-
- https://github.com/getsentry/sentry-ruby/issues/2593#issuecomment-2789569242
-
- https://github.com/getsentry/sentry-ruby/issues/2596
- Whether it's a new feature or a bug fix, make sure they're covered by new test cases
- If this PR contains any refactoring work, please give it its own commit(s)
- Finally, please add an entry to the corresponding changelog
- PR title should use conventional commit style (
feat:,fix:,ref:,meta:)
Other Notes
- We squash all commits before merging
- We generally try to review new PRs within a week
- If you have any question, you can ask for feedback in our discord community first or consult CONTRIBUTING.md or Sentry SDK development docs
Description
Describe your changes:
This introduces a custom Sentry integration for the concurrent-ruby library, ensuring proper hub and span propagation across background threads created by Concurrent::Promises.future and Concurrent::Promises::Promise.
Key changes:
Added a Sentry::ConcurrentRuby module that patches:
Concurrent::Promises.future
Concurrent::Promises::Future#on_resolution
Automatically propagates the current Sentry hub and active span to background threads.
Wraps each future/promise execution inside Sentry.with_child_span, creating a child span for async tasks.
Sets the child span as the current span for that thread to preserve the correct trace hierarchy.
Removes the need for manually calling Sentry.with_child_span inside individual futures.
Result: