Class: Sideq::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/sideq/stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStats

Returns a new instance of Stats.



5
6
7
8
9
# File 'lib/sideq/stats.rb', line 5

def initialize
  @stats = Sidekiq::Stats.new
  @retry_set = Sidekiq::RetrySet.new
  @dead_set = Sidekiq::DeadSet.new
end

Instance Attribute Details

#dead_setObject (readonly)

Returns the value of attribute dead_set.



3
4
5
# File 'lib/sideq/stats.rb', line 3

def dead_set
  @dead_set
end

#retry_setObject (readonly)

Returns the value of attribute retry_set.



3
4
5
# File 'lib/sideq/stats.rb', line 3

def retry_set
  @retry_set
end

#statsObject (readonly)

Returns the value of attribute stats.



3
4
5
# File 'lib/sideq/stats.rb', line 3

def stats
  @stats
end

Instance Method Details

#to_sObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sideq/stats.rb', line 11

def to_s
  stat_ary = [ "Processed: #{stats.processed}",
               "Failed: #{stats.failed}",
               "Scheduled size: #{stats.scheduled_size}",
               "Retry size: #{stats.retry_size}",
               "Dead size: #{stats.dead_size}",
               "Enqueued: #{stats.enqueued}",
               "Processes: #{stats.processes_size}",
               "Workers: #{stats.workers_size}",
               "Default queue latency: #{stats.default_queue_latency}",

               "Queues: dead:  #{dead_set.size}",
               "        retry: #{retry_set.size}" ]
  stats.queues.each do |(queue_name, queue_size)|
    stat_ary << "        #{queue_name}: #{queue_size}"
  end

  stat_ary.join( "\n" )
end