I want to use Bugsnag to report failed Resque jobs. How do I configure it? The documentation specifically mentions integrations with Resque, but offers no guidance as to how.
Do I have to write a Resque::Failure::Bugsnag
class? Did someone else already write it so I don't have to?
Adding to Conrad's excellent answer above, I made the following mistake which was preventing Resque jobs from appearing in Bugsnag:
Make sure to append to Resque::Failure::Multiple.classes
in your Resque initializer. I was overwriting the array in the Resque initializer, which was probably (arbitrarily) being called after the Bugsnag initializer ran.
i.e., in config/initializers/resque.rb
:
Do:
Resque::Failure::Multiple.classes ||= []
Resque::Failure::Multiple.classes << Resque::Failure::Redis
Resque::Failure.backend = Resque::Failure::Multiple
Do not:
Resque::Failure::Multiple.classes = [Resque::Failure::Redis]
Resque::Failure.backend = Resque::Failure::Multiple
The Bugsnag ruby gem is set up to automatically integrate with things like Resque. In theory all you need to do is add bugsnag and resque to your Gemfile:
gem "resque"
gem "bugsnag"
and https://github.com/bugsnag/bugsnag-ruby/blob/master/lib/bugsnag/resque.rb will do the integration work for you.
disclaimer: I work for Bugsnag, and commit to the bugsnag rubygem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With