mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Use new stats API in web UI.
This commit is contained in:
parent
187e6e90bd
commit
3e22bfd58e
3 changed files with 8 additions and 16 deletions
|
@ -34,28 +34,20 @@ module Sidekiq
|
|||
end
|
||||
end
|
||||
|
||||
def info
|
||||
@info ||= Sidekiq.info
|
||||
end
|
||||
|
||||
def processed
|
||||
info[:processed]
|
||||
Sidekiq::Stats.new.processed
|
||||
end
|
||||
|
||||
def failed
|
||||
info[:failed]
|
||||
Sidekiq::Stats.new.failed
|
||||
end
|
||||
|
||||
def zcard(name)
|
||||
Sidekiq.redis { |conn| conn.zcard(name) }
|
||||
end
|
||||
|
||||
def queues
|
||||
@queues ||= Sidekiq.info[:queues_with_sizes]
|
||||
end
|
||||
|
||||
def backlog
|
||||
info[:backlog]
|
||||
def enqueued
|
||||
Sidekiq::Stats.new.enqueued
|
||||
end
|
||||
|
||||
def retries_with_score(score)
|
||||
|
@ -122,7 +114,7 @@ module Sidekiq
|
|||
end
|
||||
|
||||
get "/queues" do
|
||||
@queues = queues
|
||||
@queues = Sidekiq::Stats.new.queues
|
||||
slim :queues
|
||||
end
|
||||
|
||||
|
|
|
@ -15,5 +15,5 @@ ul.unstyled.summary
|
|||
span.count #{number_with_delimiter(zcard('retry'))}
|
||||
span.desc Retries
|
||||
li
|
||||
span.count #{number_with_delimiter(backlog)}
|
||||
span.desc Queue
|
||||
span.count #{number_with_delimiter(enqueued)}
|
||||
span.desc Enqueued
|
||||
|
|
|
@ -5,7 +5,7 @@ table class="queues table table-hover table-bordered table-striped table-white"
|
|||
th Queue
|
||||
th Size
|
||||
th Actions
|
||||
- queues.each do |(queue, size)|
|
||||
- @queues.each do |queue, size|
|
||||
tr
|
||||
td
|
||||
a href="#{root_path}queues/#{queue}" #{queue}
|
||||
|
|
Loading…
Add table
Reference in a new issue