Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove href locator and switch to report just sizes
  • Loading branch information
Moser, Kevin authored and Moser, Kevin committed Dec 24, 2014
1 parent cff1516 commit 3689c11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
21 changes: 4 additions & 17 deletions lib/sidekiq/web.rb
Expand Up @@ -238,27 +238,16 @@ def custom_tabs
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

Expand All @@ -267,9 +256,7 @@ def custom_tabs

content_type :json
Sidekiq.dump_json(
name: queue.name,
depth: queue.size,
href: uri
size: queue.size
)
end

Expand Down
12 changes: 4 additions & 8 deletions test/test_web.rb
Expand Up @@ -390,7 +390,7 @@ def perform(a, b)
end

it 'reports queue count' do
assert_equal 1, @response["queues"]["count"]
assert_equal 1, @response["queues"]
end

describe 'queues' do
Expand All @@ -400,7 +400,7 @@ def perform(a, b)
end

it 'reports the queue depth' do
assert_equal 0, @response["default"]["depth"]
assert_equal 0, @response["default"]
end
end

Expand All @@ -410,12 +410,8 @@ def perform(a, b)
@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
Expand Down

0 comments on commit 3689c11

Please sign in to comment.