Class: Yabeda::Sidekiq::ClientMiddleware
- Inherits:
-
Object
- Object
- Yabeda::Sidekiq::ClientMiddleware
- Defined in:
- lib/yabeda/sidekiq/client_middleware.rb
Overview
Client middleware to count number of enqueued jobs
Instance Method Summary collapse
Instance Method Details
#call(worker, job, queue, _redis_pool) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/yabeda/sidekiq/client_middleware.rb', line 7 def call(worker, job, queue, _redis_pool) labels = Yabeda::Sidekiq.labelize(worker, job, job["queue"] || queue) Yabeda.sidekiq_jobs_enqueued_total.increment(labels) if job["queue"] && job["queue"] != queue labels = Yabeda::Sidekiq.labelize(worker, job, queue) Yabeda.sidekiq_jobs_rerouted_total.increment({ from_queue: queue, to_queue: job["queue"], **labels.except(:queue) }) end yield end |