Class: AutoScaleWorkers::SidekiqCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/auto_scale_workers/sidekiq_collector.rb

Class Method Summary collapse

Class Method Details

.get_stat(queues = []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/auto_scale_workers/sidekiq_collector.rb', line 5

def self.get_stat(queues = [])
  queues = Sidekiq::Queue.all if queues.empty?
  payload = {}
  queues.each do |queue|
    payload[queue.name] = { size: queue.size,
                            latency: queue.latency,
                            paused: queue.paused? }
  end
  payload['stats'] = Sidekiq::Stats.new.fetch_stats_fast!
  payload
end