Class: Sidekiq::Stats
- Inherits:
-
Object
- Object
- Sidekiq::Stats
- Defined in:
- lib/sidekiq/api.rb
Overview
Defined Under Namespace
Classes: History
Instance Method Summary collapse
- #dead_size ⇒ Object
- #default_queue_latency ⇒ Object
- #enqueued ⇒ Object
- #failed ⇒ Object
-
#initialize ⇒ Stats
constructor
A new instance of Stats.
- #processed ⇒ Object
- #processes_size ⇒ Object
- #queues ⇒ Object
- #retry_size ⇒ Object
- #scheduled_size ⇒ Object
- #workers_size ⇒ Object
Constructor Details
#initialize ⇒ Stats
Returns a new instance of Stats.
26 27 28 |
# File 'lib/sidekiq/api.rb', line 26 def initialize fetch_stats_fast! end |
Instance Method Details
#dead_size ⇒ Object
46 47 48 |
# File 'lib/sidekiq/api.rb', line 46 def dead_size stat :dead_size end |
#default_queue_latency ⇒ Object
62 63 64 |
# File 'lib/sidekiq/api.rb', line 62 def default_queue_latency stat :default_queue_latency end |
#enqueued ⇒ Object
50 51 52 |
# File 'lib/sidekiq/api.rb', line 50 def enqueued stat :enqueued end |
#failed ⇒ Object
34 35 36 |
# File 'lib/sidekiq/api.rb', line 34 def failed stat :failed end |
#processed ⇒ Object
30 31 32 |
# File 'lib/sidekiq/api.rb', line 30 def processed stat :processed end |
#processes_size ⇒ Object
54 55 56 |
# File 'lib/sidekiq/api.rb', line 54 def processes_size stat :processes_size end |
#queues ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/sidekiq/api.rb', line 66 def queues Sidekiq.redis do |conn| queues = conn.sscan("queues").to_a lengths = conn.pipelined { |pipeline| queues.each do |queue| pipeline.llen("queue:#{queue}") end } array_of_arrays = queues.zip(lengths).sort_by { |_, size| -size } array_of_arrays.to_h end end |
#retry_size ⇒ Object
42 43 44 |
# File 'lib/sidekiq/api.rb', line 42 def retry_size stat :retry_size end |
#scheduled_size ⇒ Object
38 39 40 |
# File 'lib/sidekiq/api.rb', line 38 def scheduled_size stat :scheduled_size end |
#workers_size ⇒ Object
58 59 60 |
# File 'lib/sidekiq/api.rb', line 58 def workers_size stat :workers_size end |