20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/newrelic-sidekiq-stats.rb', line 20
def poll
return unless Sidekiq.server?
stats = Sidekiq::Stats.new
max_latency = Sidekiq::Queue.all.map(&:latency).max
::NewRelic::Agent.logger.debug("Recording metric: Custom/Sidekiq/QueueLatency=#{max_latency}")
::NewRelic::Agent.record_metric("Custom/Sidekiq/QueueLatency", max_latency)
METRIC_MAP.map do |key, name|
value = stats.public_send(key)
::NewRelic::Agent.logger.debug("Recording metric: Custom/Sidekiq/#{name}=#{value}")
::NewRelic::Agent.record_metric("Custom/Sidekiq/#{name}", value)
end
end
|