Class: TjScaleRuby::JobBackends::Sidekiq
- Inherits:
-
Object
- Object
- TjScaleRuby::JobBackends::Sidekiq
- Defined in:
- lib/tj_scale_ruby/job_backends/sidekiq.rb
Overview
Reads queue depth and latency from the Sidekiq API (Redis). Requires the host app to bundle sidekiq; priority filters do not apply —use TJ_SCALE_SIDEKIQ_QUEUES to limit which queues are counted.
Class Method Summary collapse
- .backend_name ⇒ Object
-
.oldest_pending_queue_seconds(_now = nil) ⇒ Object
Latency (seconds since the oldest enqueued job) of the slowest monitored queue.
- .pending_job_count(_now = nil) ⇒ Object
Class Method Details
.backend_name ⇒ Object
10 11 12 |
# File 'lib/tj_scale_ruby/job_backends/sidekiq.rb', line 10 def backend_name "sidekiq" end |
.oldest_pending_queue_seconds(_now = nil) ⇒ Object
Latency (seconds since the oldest enqueued job) of the slowest monitored queue.
20 21 22 23 24 |
# File 'lib/tj_scale_ruby/job_backends/sidekiq.rb', line 20 def oldest_pending_queue_seconds(_now = nil) ensure_loaded! latency = queues.map(&:latency).max latency.nil? ? 0 : latency.ceil end |
.pending_job_count(_now = nil) ⇒ Object
14 15 16 17 |
# File 'lib/tj_scale_ruby/job_backends/sidekiq.rb', line 14 def pending_job_count(_now = nil) ensure_loaded! queues.sum(&:size) end |