Class: SidekiqVigil::Check::QueueSize

Inherits:
Base
  • Object
show all
Defined in:
lib/sidekiq_vigil/check/queue_size.rb

Instance Attribute Summary

Attributes inherited from Base

#api, #clock, #logger, #options, #storage

Instance Method Summary collapse

Methods inherited from Base

#check_name, #execute, #initialize

Constructor Details

This class inherits a constructor from SidekiqVigil::Check::Base

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sidekiq_vigil/check/queue_size.rb', line 6

def call
  api.queues(options.fetch(:queues, :all)).map do |queue|
    thresholds = options.merge(options.fetch(:per_queue, {}).fetch(queue.name, {}))
    threshold_result(
      target: queue.name,
      value: queue.size,
      warn: thresholds.fetch(:warn, 1_000),
      critical: thresholds.fetch(:critical, 10_000),
      message: "#{queue.size} jobs waiting"
    )
  end
end