mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add processes to stats
This commit is contained in:
parent
cf779590bb
commit
94fa624c77
4 changed files with 16 additions and 3 deletions
|
@ -50,7 +50,7 @@ module Sidekiq
|
|||
p.quiet! if params[:quiet]
|
||||
p.stop! if params[:stop]
|
||||
else
|
||||
Sidekiq::ProcessSet.new.each do |pro|
|
||||
processes.each do |pro|
|
||||
pro.quiet! if params[:quiet]
|
||||
pro.stop! if params[:stop]
|
||||
end
|
||||
|
@ -219,6 +219,7 @@ module Sidekiq
|
|||
processed: sidekiq_stats.processed,
|
||||
failed: sidekiq_stats.failed,
|
||||
busy: workers_size,
|
||||
processes: processes_size,
|
||||
enqueued: sidekiq_stats.enqueued,
|
||||
scheduled: sidekiq_stats.scheduled_size,
|
||||
retries: sidekiq_stats.retry_size,
|
||||
|
|
|
@ -46,6 +46,14 @@ module Sidekiq
|
|||
@workers ||= Sidekiq::Workers.new
|
||||
end
|
||||
|
||||
def processes_size
|
||||
@processes_size ||= processes.size
|
||||
end
|
||||
|
||||
def processes
|
||||
@processes ||= Sidekiq::ProcessSet.new
|
||||
end
|
||||
|
||||
def stats
|
||||
@stats ||= Sidekiq::Stats.new
|
||||
end
|
||||
|
|
|
@ -404,6 +404,10 @@ class TestWeb < Sidekiq::Test
|
|||
assert_equal 4, @response["sidekiq"]["busy"]
|
||||
end
|
||||
|
||||
it 'reports processes' do
|
||||
assert_equal 1, @response["sidekiq"]["processes"]
|
||||
end
|
||||
|
||||
it 'reports retries' do
|
||||
assert_equal 2, @response["sidekiq"]["retries"]
|
||||
end
|
||||
|
@ -568,7 +572,7 @@ class TestWeb < Sidekiq::Test
|
|||
Sidekiq.redis do |conn|
|
||||
conn.multi do
|
||||
conn.sadd("processes", key)
|
||||
conn.hmset(key, 'busy', 4)
|
||||
conn.hmset(key, 'info', Sidekiq.dump_json('hostname' => 'foo', 'started_at' => Time.now.to_f, "queues" => []), 'at', Time.now.to_f, 'busy', 4)
|
||||
conn.hmset("#{key}:workers", Time.now.to_f, msg)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<th><%= t('Busy') %></th>
|
||||
<th> </th>
|
||||
</thead>
|
||||
<% Sidekiq::ProcessSet.new.each do |process| %>
|
||||
<% processes.each do |process| %>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<%= "#{process['hostname']}:#{process['pid']}" %>
|
||||
|
|
Loading…
Add table
Reference in a new issue