diff --git a/lib/sidekiq/web.rb b/lib/sidekiq/web.rb index f6e0acac..ab6cb96b 100644 --- a/lib/sidekiq/web.rb +++ b/lib/sidekiq/web.rb @@ -238,27 +238,16 @@ module Sidekiq scheduled: sidekiq_stats.scheduled_size, retries: sidekiq_stats.retry_size, dead: sidekiq_stats.dead_size, - queues: { - count: queues.size, - href: "#{uri}/queues" - } + queues: queues.size ) end get '/stats/queues' do - queues = Sidekiq::Queue.all - - queue_sizes = queues.reduce({}) do |ret, queue| - ret[queue.name] = { - depth: queue.size, - href: "#{uri}/#{queue.name}" - } - ret - end + stats = Sidekiq::Stats.new content_type :json Sidekiq.dump_json( - queue_sizes + stats.queues ) end @@ -267,9 +256,7 @@ module Sidekiq content_type :json Sidekiq.dump_json( - name: queue.name, - depth: queue.size, - href: uri + size: queue.size ) end diff --git a/test/test_web.rb b/test/test_web.rb index 5be4a66b..6cb948e7 100644 --- a/test/test_web.rb +++ b/test/test_web.rb @@ -390,7 +390,7 @@ class TestWeb < Sidekiq::Test end it 'reports queue count' do - assert_equal 1, @response["queues"]["count"] + assert_equal 1, @response["queues"] end describe 'queues' do @@ -400,7 +400,7 @@ class TestWeb < Sidekiq::Test end it 'reports the queue depth' do - assert_equal 0, @response["default"]["depth"] + assert_equal 0, @response["default"] end end @@ -410,12 +410,8 @@ class TestWeb < Sidekiq::Test @response = Sidekiq.load_json(last_response.body) end - it 'reports the queue depth' do - assert_equal 0, @response["depth"] - end - - it 'reports the queue name' do - assert_equal 'default', @response["name"] + it 'reports the queue size' do + assert_equal 0, @response["size"] end end end