If you've set up Errbit/Airbrake and you use Sidekiq, by default you would expect, that Errbit tracks things that happen in Sidekiq workers as well. Unfortunately it doesn't.
In order to make Sidekiq retry failed jobs in needs to catch and handle exceptions on its own. And that's the reason why you need a bit of "magic" to make it work with Errbit. You need to add an custom error handler that will notify Errbit app about errors that occured in Sidekiq workers.
To do so, just create an initializer like this:
# Errbit error catching for Sidekiq workers Sidekiq.configure_server do |config| config.error_handlers << Proc.new { |ex,ctx_hash| Airbrake.notify_or_ignore(ex, ctx_hash) } end
And that's all!
July 25, 2014 — 18:14
Use `Airbrake.notify_or_ignore` instead!
Sidekiq.configure_server do |config|
config.error_handlers << Proc.new { |exception, context| Airbrake.notify_or_ignore(exception, parameters: context) }
end
https://github.com/airbrake/airbrake/issues/269#issuecomment-39036722
July 25, 2014 — 18:57
You’re absolutely right ;) Thanks for the update!
October 23, 2014 — 17:19
I’m noticing that many times the arguments for the Sidekiq job don’t make it to Errbit – the Errbit parameters tab remains empty, which makes it hard to debug. Any ideas?