-
-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Active-)Job errors not send (sentry-resque) #1754
Comments
When I patch the
Everything works fine, as the sentry-resque integration gets to handle an uncaptured error and reports it to Sentry. |
@Flixt I'm sorry for the trouble. And thanks for the amazingly detailed report. I think there are 2 major causes of it:
There's an on going issue (#1731) for 1), which makes me think if we should have that support opt-out by default. Do you think the contextual data is rich enough for events sent through the And I'll also investigate 2) because after #1617, all events should still be sent with/without |
@Flixt Ok, I think 2) is a Resque issue. Currently, its workers exit with I'm not sure if the SDK can do anything about it without potentially mess things up further. But if you set
|
@st0012 thank you for your feedback.
I think users should actively opt in to let the ErrorSubscriber capture their exceptions. At least for us it was a surprise |
@Flixt Thanks for all the feedback. I will make the error subscriber registration an opt-in thing, as it's been causing too many issues for users. I'm sorry about that. And speaking of testing, do you think if the SDK packs with test helpers (so you don't actually send the events), you'll be more keen to write error reporting tests? As described here: #1680 The idea is that, error reporting is already essential for most of the apps. And having such an important component uncovered by tests could be risky, from losing contextual data to incorrectly using an interface. |
FYI, I'll change the error reporter integration in |
No worries! Glad we figured that out :)
Not having to mock the requests myself would be a big benefit that would definitely make me more willing to ensure things get reported in the future. Feel free to change the state of this issue as you want since I consider it "fixed". At least for us the monkey patch will work until 5.3.0 is released. Then we will probably just opt out of the resque integration and use the Rails ErrorReporter. |
Close via #1771 |
Issue Description
Errors that happen within Jobs are not sent to Sentry when using
sentry-rails
andsentry-resque
The problem was encountered after upgrading our app to Rails 7 and Ruby 3.0.2
We upgraded:
sentry-ruby
from'~> 4.6.5'
, to'~> 5.1.1'
sentry-rails
from'~> 4.6.5'
, to'~> 5.1.1'
And we switched from our own fork of
resque-sentry
tosentry-resque', '~> 5.1.1'
We noticed after a while, errors from whithin our jobs are no longer reported to Sentry.
I tried to hunt down the bug and here is what I found so far. Some facts beforehand:
config.background_worker_threads > 0
the option `{hint: {background: false}} is needed for capture_exception/capture_messageresque:workers
rake taskReproduction Steps
I forked the repository and changed the Rails 7.0 example app of sentry-rails in a way to make it possible to reproduce the issue described above.
The diff of the fork can be found here (I did not open a PR as this does not contain a fix):
master...flowdgmbh:no-resque-events-example
cd sentry-ruby/sentry-rails/examples/rails-7.0
bundle install
sentry-rails/examples/rails-7.0/config/initializers/sentry.rb
bundle exec rails runner 'ErrorJob.perform_later'
Expected Behavior
The error is reported to sentry
Actual Behavior
The following happens for us when an error occours in the job (in the context of the separate Reqsue worker):
Sentry::Rails::ActiveJobExtensions
decides the error is handled by an integration (sentry-resque) in https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/lib/sentry/rails/active_job.rb#L5Sentry::Rails::ErrorSubscriber
gets the error via instrumentation and callscapture_exception
. But it does so without{hint: {background: false}}
so no HTTP request is made to Sentrycapture_exception
correctly with `{hint: {background: false}}Result: No error was sent to Sentry
Ruby Version
3.1.0
SDK Version
5.1.1
Integration and Its Version
No response
Sentry Config
No response
The text was updated successfully, but these errors were encountered: