Class: Nexaas::QueueTime::Sidekiq

Inherits:
Object
  • Object
show all
Defined in:
lib/nexaas/queue_time/sidekiq.rb

Overview

Measures the latency for all Sidekiq queues and send it to Datadog.

Constant Summary collapse

METRIC_NAME =
'sidekiq.queue.latency_ms'

Class Method Summary collapse

Class Method Details

.measure_latencyObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/nexaas/queue_time/sidekiq.rb', line 19

def self.measure_latency
  ::Sidekiq::Queue.all.each do |queue|
    latency_in_ms = (queue.latency * 1000).ceil
    opts = {
      sample_rate: 1,
      tags: { queue_name: queue.name }
    }
    DogStatsd.timing(METRIC_NAME, latency_in_ms, opts)
  end
end