Class: Sidekiq::Monitor::Stats
- Inherits:
-
Object
- Object
- Sidekiq::Monitor::Stats
- Defined in:
- lib/sidekiq/monitor/stats.rb
Instance Method Summary collapse
Instance Method Details
#job_metrics ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/sidekiq/monitor/stats.rb', line 35 def job_metrics Sidekiq::Workers.new.map do |process, thread, msg| job = Sidekiq::Job.new(msg['payload']) { process: process, thread: thread, jid: job.jid, queue: msg['queue'], job: job.display_class, run_at: Time.at(msg['run_at']) } end end |
#process_metrics ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sidekiq/monitor/stats.rb', line 20 def process_metrics Sidekiq::ProcessSet.new.map do |process| { hostname: process['hostname'], pid: process['pid'], tag: process['tag'], started_at: Time.at(process['started_at']), queues: process['queues'], labels: process['labels'], concurrency: process['concurrency'], busy: process['busy'] } end end |
#queue_metrics ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/sidekiq/monitor/stats.rb', line 11 def queue_metrics Sidekiq::Queue.all.each_with_object({}) do |queue, hash| hash[queue.name] = { backlog: queue.size, latency: queue.latency.to_i } end end |