Created
March 28, 2012 04:54
-
-
Save granth/2223758 to your computer and use it in GitHub Desktop.
delayed_job exception notification with airbrake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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