Module: Metrician::Jobs::ResquePlugin::Extension
- Defined in:
- lib/metrician/jobs/resque_plugin.rb
Instance Method Summary collapse
Instance Method Details
#around_perform_with_metrician(*_args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/metrician/jobs/resque_plugin.rb', line 7 def around_perform_with_metrician(*_args) start = Time.now yield ensure if Jobs.run? duration = Time.now - start Metrician.gauge(Jobs::RUN_METRIC, duration) if Jobs.job_specific? Metrician.gauge("#{Jobs::RUN_METRIC}.job.#{Jobs.instrumentation_name(self.to_s)}", duration) end Metrician.agent.cleanup end end |
#on_failure_with_metrician(_e, *_args) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/metrician/jobs/resque_plugin.rb', line 21 def on_failure_with_metrician(_e, *_args) if Jobs.error? Metrician.increment(Jobs::ERROR_METRIC) if Jobs.job_specific? Metrician.increment("#{Jobs::ERROR_METRIC}.job.#{Jobs.instrumentation_name(self.to_s)}") end Metrician.agent.cleanup end end |