Skip to content

Instantly share code, notes, and snippets.

@Hampei
Last active August 29, 2015 14:08
Show Gist options
  • Save Hampei/9e09d66bad65bdcefd3c to your computer and use it in GitHub Desktop.
Save Hampei/9e09d66bad65bdcefd3c to your computer and use it in GitHub Desktop.
appsignal stats and error handling for que.gem
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