class SidekiqHero::Recorder
Attributes
meta_data[R]
Public Class Methods
new()
click to toggle source
# File lib/sidekiq_hero/recorder.rb, line 7 def initialize @meta_data = {} end
Public Instance Methods
elapsed_time()
click to toggle source
# File lib/sidekiq_hero/recorder.rb, line 11 def elapsed_time total = meta_data.fetch(:ended_at, 0) - meta_data.fetch(:started_at, 0) record(total_time: total) end
worker_ended()
click to toggle source
# File lib/sidekiq_hero/recorder.rb, line 28 def worker_ended record(ended_at: Time.now.utc.round) end
worker_failed(error)
click to toggle source
# File lib/sidekiq_hero/recorder.rb, line 24 def worker_failed(error) record(status: 'failed', error: error.to_s) end
worker_passed()
click to toggle source
# File lib/sidekiq_hero/recorder.rb, line 16 def worker_passed record(status: 'passed', started_at: Time.now.utc.round) end
worker_succeeded()
click to toggle source
# File lib/sidekiq_hero/recorder.rb, line 20 def worker_succeeded record(status: 'success') end
Private Instance Methods
record(hash)
click to toggle source
# File lib/sidekiq_hero/recorder.rb, line 34 def record(hash) meta_data.merge!(hash) end