Class: OkComputer::SidekiqLatencyCheck
- Inherits:
-
SizeThresholdCheck
- Object
- Check
- SizeThresholdCheck
- OkComputer::SidekiqLatencyCheck
- Defined in:
- lib/ok_computer/built_in_checks/sidekiq_latency_check.rb
Constant Summary
Constants inherited from Check
Instance Attribute Summary collapse
-
#queue ⇒ Object
Returns the value of attribute queue.
Attributes inherited from SizeThresholdCheck
Attributes inherited from Check
#failure_occurred, #message, #registrant_name, #time
Instance Method Summary collapse
-
#initialize(queue, threshold = 30) ⇒ SidekiqLatencyCheck
constructor
Public: Initialize a check for a backed-up Sidekiq queue See github.com/mperham/sidekiq/wiki/Monitoring#monitoring-queue-latency.
-
#size ⇒ Object
Public: The latency of the check’s queue (in seconds).
Methods inherited from SizeThresholdCheck
Methods inherited from Check
#<=>, #clear, #mark_failure, #mark_message, #run, #success?, #to_json, #to_text, #with_benchmarking
Constructor Details
#initialize(queue, threshold = 30) ⇒ SidekiqLatencyCheck
Public: Initialize a check for a backed-up Sidekiq queue See github.com/mperham/sidekiq/wiki/Monitoring#monitoring-queue-latency
queue - The name of the Sidekiq queue to check threshold - An Integer to compare the queue’s latency against to consider
it backed up
16 17 18 19 20 |
# File 'lib/ok_computer/built_in_checks/sidekiq_latency_check.rb', line 16 def initialize(queue, threshold = 30) self.queue = queue self.name = "Sidekiq queue '#{queue}' latency" self.threshold = Integer(threshold) end |
Instance Attribute Details
#queue ⇒ Object
Returns the value of attribute queue.
8 9 10 |
# File 'lib/ok_computer/built_in_checks/sidekiq_latency_check.rb', line 8 def queue @queue end |
Instance Method Details
#size ⇒ Object
Public: The latency of the check’s queue (in seconds)
23 24 25 |
# File 'lib/ok_computer/built_in_checks/sidekiq_latency_check.rb', line 23 def size Sidekiq::Queue.new(queue).latency end |