Module: Statue::SidekiqStatistics
- Defined in:
- lib/statue/sidekiq_statistics.rb
Overview
This module simplifies the job statistics tracking using Statue
-
Provides a SidekiqMiddleware (to track performance and latency)
-
Provides a method for tracking other middleware events (eg. throttling, deadline)
The current set of metrics are:
-
count job.<queue>.<job_name>.(success|failure): depending if the job succeeded or failed
-
count job.<queue>.<job_name>.throttled: only if the job was throttled by sidekiq-throttler
-
count job.<queue>.<job_name>.overdue: only if the deadline from run_deadline_middleware was reached
-
count job.<queue>.<job_name>.retry: only if the job corresponds to a retry for a previously failed job
-
duration job.<queue>.<job_name>.latency: time difference between now and when the job last entered the queue
-
duration job.<queue>.<job_name>: job run duration (reported only if the job doesn’t fail)
Defined Under Namespace
Modules: ThrottlingExceeded Classes: SidekiqMiddleware
Class Method Summary collapse
Class Method Details
.count_event(event, worker, message) ⇒ Object
23 24 25 |
# File 'lib/statue/sidekiq_statistics.rb', line 23 def self.count_event(event, worker, ) Statue.report_increment("#{job_metric_name(worker, )}.#{event}") end |
.job_metric_name(worker, message) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/statue/sidekiq_statistics.rb', line 27 def self.job_metric_name(worker, ) job_name = if worker.respond_to?(:job_name) worker.job_name(*["args"]) elsif .dig("args", 0, "job_class") # search for the class name that resides in the message received .dig("args", 0, "job_class") else worker.class.name.gsub(/::/, "-") end "job.#{["queue"]}.#{job_name}" end |