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
|
||||||
end
|
end
|
||||||
|
|
||||||
def info
|
|
||||||
@info ||= Sidekiq.info
|
|
||||||
end
|
|
||||||
|
|
||||||
def processed
|
def processed
|
||||||
info[:processed]
|
Sidekiq::Stats.new.processed
|
||||||
end
|
end
|
||||||
|
|
||||||
def failed
|
def failed
|
||||||
info[:failed]
|
Sidekiq::Stats.new.failed
|
||||||
end
|
end
|
||||||
|
|
||||||
def zcard(name)
|
def zcard(name)
|
||||||
Sidekiq.redis { |conn| conn.zcard(name) }
|
Sidekiq.redis { |conn| conn.zcard(name) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def queues
|
def enqueued
|
||||||
@queues ||= Sidekiq.info[:queues_with_sizes]
|
Sidekiq::Stats.new.enqueued
|
||||||
end
|
|
||||||
|
|
||||||
def backlog
|
|
||||||
info[:backlog]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def retries_with_score(score)
|
def retries_with_score(score)
|
||||||
|
@ -122,7 +114,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/queues" do
|
get "/queues" do
|
||||||
@queues = queues
|
@queues = Sidekiq::Stats.new.queues
|
||||||
slim :queues
|
slim :queues
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,5 @@ ul.unstyled.summary
|
||||||
span.count #{number_with_delimiter(zcard('retry'))}
|
span.count #{number_with_delimiter(zcard('retry'))}
|
||||||
span.desc Retries
|
span.desc Retries
|
||||||
li
|
li
|
||||||
span.count #{number_with_delimiter(backlog)}
|
span.count #{number_with_delimiter(enqueued)}
|
||||||
span.desc Queue
|
span.desc Enqueued
|
||||||
|
|
|
@ -5,7 +5,7 @@ table class="queues table table-hover table-bordered table-striped table-white"
|
||||||
th Queue
|
th Queue
|
||||||
th Size
|
th Size
|
||||||
th Actions
|
th Actions
|
||||||
- queues.each do |(queue, size)|
|
- @queues.each do |queue, size|
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
a href="#{root_path}queues/#{queue}" #{queue}
|
a href="#{root_path}queues/#{queue}" #{queue}
|
||||||
|
|
Loading…
Add table
Reference in a new issue