Class: QueuePulse::Checks::QueueLatency
- Defined in:
- lib/queue_pulse/checks/queue_latency.rb
Overview
Alerts when the oldest ready job in a queue has been waiting longer than queue_latency_threshold — i.e. work is backing up before users feel it. Cooldown is per-queue. (Requirements US-3.1, US-3.3, US-3.4.)
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from QueuePulse::Checks::Base
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/queue_pulse/checks/queue_latency.rb', line 9 def call threshold = config.queue_latency_threshold now = source.now source.queue_stats.filter_map do |stat| next unless stat.oldest_enqueued_at latency = (now - stat.oldest_enqueued_at).to_i next if latency < threshold with_cooldown("queue_latency:#{stat.queue_name}") do latency_alert(stat, latency) end end end |