Class: JobTick::Monitor
- Inherits:
-
Object
- Object
- JobTick::Monitor
- Defined in:
- lib/jobtick/monitor.rb
Class Method Summary collapse
Class Method Details
.run(key) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jobtick/monitor.rb', line 5 def self.run(key) return yield unless JobTick.config.enabled started_at = Time.now JobTick.client.ping(key, status: :started) result = yield duration = Time.now - started_at JobTick.client.ping(key, status: :completed, duration: duration) result rescue StandardError => e JobTick.client.ping(key, status: :failed, message: e.) raise end |