module Sidekiq::HeartbeatMonitor

Constants

VERSION

Public Class Methods

config(queue = nil) click to toggle source
# 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.to_h[queue_name] || @global_config
end
configure(options = {}) click to toggle source
# 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) click to toggle source
# 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