Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
delayed_job exception notification with airbrake
module Delayed
module Plugins
class Airbrake < Plugin
module Notify
def error(job, error)
::Airbrake.notify_or_ignore(error)
super
end
end
callbacks do |lifecycle|
lifecycle.before(:invoke_job) do |job|
payload = job.payload_object
payload = payload.object if payload.is_a? Delayed::PerformableMethod
payload.extend Notify
end
end
end
end
end
Delayed::Worker.plugins << Delayed::Plugins::Airbrake
@AgileMantis

This comment has been minimized.

Copy link

@AgileMantis AgileMantis commented Nov 30, 2012

Awesome, thanks!

@rchampourlier

This comment has been minimized.

Copy link

@rchampourlier rchampourlier commented Jan 5, 2013

Excellent, thanks for sharing!

Here is a StackOverflow question where I shared your gist and a little-customized version of your code, which improves what is sent to Airbrake (using parts of the available answers on the SO question).

@paulkoegel

This comment has been minimized.

Copy link

@paulkoegel paulkoegel commented Feb 15, 2013

thank you!

@benjaminoakes

This comment has been minimized.

Copy link

@benjaminoakes benjaminoakes commented Mar 15, 2013

I really like this approach. I couldn't find a version released as a gem, so in thanks for sharing this, I packaged it as a gem for others to easily use. If you'd like write access, etc, please let me know!

https://github.com/benjaminoakes/delayed-plugins-airbrake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment