Module: Sidekiq::HeartbeatMonitor

Defined in:
lib/sidekiq/heartbeat_monitor.rb,
lib/sidekiq/heartbeat_monitor/util.rb,
lib/sidekiq/heartbeat_monitor/config.rb,
lib/sidekiq/heartbeat_monitor/worker.rb,
lib/sidekiq/heartbeat_monitor/railtie.rb,
lib/sidekiq/heartbeat_monitor/version.rb,
lib/sidekiq/heartbeat_monitor/scheduler.rb,
lib/sidekiq/heartbeat_monitor/test_worker.rb

Defined Under Namespace

Modules: Util Classes: Config, Railtie, Scheduler, TestWorker, Worker

Constant Summary collapse

VERSION =
'1.0.3.0'

Class Method Summary collapse

Class Method Details

.config(queue = nil) ⇒ Object



26
27
28
29
30
31
# File 'lib/sidekiq/heartbeat_monitor.rb', line 26

def self.config(queue = nil)
  return @global_config if queue.blank?

  queue_name = queue.is_a?(String) || queue.is_a?(Symbol) ? queue.to_s : queue.name.to_s
  @queue_config[queue_name] || @global_config
end

.configure(options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sidekiq/heartbeat_monitor.rb', line 14

def self.configure(options = {})
  options = options.symbolize_keys
  global_options = options.except(:queues)

  @global_config = Config.new(**global_options)

  @queue_config = {}
  options[:queues].to_a.each do |queue_name, queue_options|
    @queue_config[queue_name.to_s] = Config.new(**global_options.deep_merge(queue_options))
  end
end

.send_test!(queue_name = nil) ⇒ Object



33
34
35
36
37
38
# File 'lib/sidekiq/heartbeat_monitor.rb', line 33

def self.send_test!(queue_name = nil)
  test_queue = Sidekiq::Queue.new(queue_name || 'test')

  send_backed_up_alert("Test backed up alert!", test_queue)
  send_slowed_down_alert("Test slowed down alert!", test_queue)
end