1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Add a "latency" stat in the dashboard

This commit is contained in:
Jérémy Lecour 2013-10-04 09:18:04 +02:00
parent b906b873d9
commit 7908675264
2 changed files with 6 additions and 0 deletions

View file

@ -315,6 +315,7 @@ module Sidekiq
get '/dashboard/stats' do
sidekiq_stats = Sidekiq::Stats.new
queue = Sidekiq::Queue.new
redis_stats = Sidekiq.redis { |conn| conn.info }.select{ |k, v| redis_keys.include? k }
content_type :json
@ -326,6 +327,7 @@ module Sidekiq
enqueued: sidekiq_stats.enqueued,
scheduled: sidekiq_stats.scheduled_size,
retries: sidekiq_stats.retry_size,
latency: queue.latency,
},
redis: redis_stats
})

View file

@ -324,6 +324,10 @@ class TestWeb < Sidekiq::Test
it 'reports scheduled' do
assert_equal 3, @response["sidekiq"]["scheduled"]
end
it 'reports latency' do
assert_equal 0, @response["sidekiq"]["latency"]
end
end
describe "for redis" do