Last active
August 29, 2015 14:08
-
-
Save Hampei/9e09d66bad65bdcefd3c to your computer and use it in GitHub Desktop.
appsignal stats and error handling for que.gem
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 AppSignalQue | |
def _run(*args) | |
Appsignal.monitor_transaction( | |
'perform_job.que', | |
:class => self.class, | |
:method => 'run', | |
:attempts => attrs[:error_count], | |
:queue => attrs[:queue], | |
:queue_time => (Time.now.to_f - attrs['run_at'].to_f) * 1000, | |
) do | |
Appsignal::Transaction.current.set_tags(Hash[args.map.with_index { |x, i| ["param_#{i}", x.to_s] }]) | |
super | |
end | |
end | |
end | |
Que::Job.prepend AppSignalQue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment