sidekiq-queue-stats 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 026c2ff9f949d48ada4885f8e7dae2b4679389bd
4
- data.tar.gz: 4fcdbfad5a850932a63b55c850780ed07e1b64f8
3
+ metadata.gz: 51e57c307b05076c0fbff272ff625e063eb14365
4
+ data.tar.gz: 106453857a501e1a0d20a395b3ca3e7573ede51f
5
5
  SHA512:
6
- metadata.gz: 220467b4fda45cf4809e1126795ae03990ac82e11b0362ff9896aa044b75deaaf4de95f181a0e944aa9a2d31d3058c7eb2ecf3804046123034f9da0250852f9c
7
- data.tar.gz: 3e8e08b53beb70950bbdab3640b14b3b1e46e4e8acdba1be8136f6646aa8642e85aa4f75283adb1efae6027f93112757820e3d59674d39fc58436bf227169ac6
6
+ metadata.gz: 60d1d2482649a54b3204dda12cbbac5c31d72695c9a7a85edf934473526c2b5991792fd4a5d5a7134829c4fb85054b874a28e3d3cec7e07c6c671c1030504086
7
+ data.tar.gz: 0de12313c8889f37d8af4311d7645b9b151b0e1fa2e6a772b485002d94f8f6638234287e495fbdbd4651654a1452f6ef76fc7aed9d2540a5d8403aceba951f16
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module QueueStats
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -1,26 +1,27 @@
1
1
  <header class="row">
2
- <div class="col-sm-5">
2
+ <div class="col-sm-10">
3
3
  <h3>Queue Stats</h3>
4
4
  </div>
5
+ <div class="dropdown col-sm-2">
6
+ <button class="btn btn-default dropdown-toggle pull-right" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
7
+ Queues
8
+ <span class="caret"></span>
9
+ </button>
10
+ <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
11
+ <li><a href="?">All</a></li>
12
+ <% @qs.each do |q| %>
13
+ <li><a href=<%="?queue=#{q.downcase}"%>><%= q.capitalize %></a></li>
14
+ <% end %>
15
+ </ul>
16
+ </div>
5
17
  </header>
6
18
 
7
- <div class="dropdown pull-right">
8
- <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
9
- Queues
10
- <span class="caret"></span>
11
- </button>
12
- <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
13
- <li><a href="#">All</a></li>
14
- <% @queues.each do |q| %>
15
- <li><a href=<%="?queue=#{q.downcase}"%>><%= q.capitalize %></a></li>
16
- <% end %>
17
- </ul>
18
- </div>
19
+
19
20
 
20
21
  <%= csrf_tag if respond_to?(:csrf_tag) %>
21
22
  <% if params[:queue] %>
22
- <h4><%= @queue.name.capitalize %></h4>
23
- <% if @workers[@queue.name].nil? %>
23
+ <h4><%= @q.name.capitalize %></h4>
24
+ <% if @wrks[@q.name].empty? %>
24
25
  <div class="alert alert-success">Nothing waiting in queue</div>
25
26
  <% else %>
26
27
  <table class="table table-striped table-bordered table-white">
@@ -30,7 +31,7 @@
30
31
  <th style="width: 150px">Count</th>
31
32
  </tr>
32
33
  </thead>
33
- <% @workers[@queue.name].each do |worker| %>
34
+ <% @wrks[@q.name].each do |worker| %>
34
35
  <tr>
35
36
  <td><%=worker.first%></td>
36
37
  <td><%=worker.last%></td>
@@ -39,25 +40,29 @@
39
40
  </table>
40
41
  <% end %>
41
42
  <% else %>
42
- <% @queues.each do |q| %>
43
- <h4><%= q.capitalize %></h4>
44
- <% if @workers[q].empty? %>
45
- <div class="alert alert-success">Nothing waiting in queue</div>
46
- <% else %>
47
- <table class="table table-striped table-bordered table-white">
48
- <thead>
49
- <tr>
50
- <th>Name</th>
51
- <th style="width: 150px">Count</th>
52
- </tr>
53
- </thead>
54
- <% @workers[q].each do |worker| %>
55
- <tr>
56
- <td><%=worker.first%></td>
57
- <td><%=worker.last%></td>
58
- </tr>
59
- <% end %>
60
- </table>
43
+ <% if @qs.empty? %>
44
+ <div class="alert alert-success">Nothing waiting in any queue</div>
45
+ <% else %>
46
+ <% @qs.each do |q| %>
47
+ <h4><%= q.capitalize %></h4>
48
+ <% if @wrks[q].empty? %>
49
+ <div class="alert alert-success">Nothing waiting in queue</div>
50
+ <% else %>
51
+ <table class="table table-striped table-bordered table-white">
52
+ <thead>
53
+ <tr>
54
+ <th>Name</th>
55
+ <th style="width: 150px">Count</th>
56
+ </tr>
57
+ </thead>
58
+ <% @wrks[q].each do |worker| %>
59
+ <tr>
60
+ <td><%=worker.first%></td>
61
+ <td><%=worker.last%></td>
62
+ </tr>
63
+ <% end %>
64
+ </table>
65
+ <% end %>
61
66
  <% end %>
62
67
  <% end %>
63
68
  <% end %>
@@ -6,20 +6,20 @@ module QueueStats
6
6
  view_path = File.join(File.expand_path("..", __FILE__), "views")
7
7
 
8
8
  app.get "/queue_stats" do
9
- @queues = Sidekiq::Queue.all.map(&:name)
10
- @workers = {}
9
+ @qs = Sidekiq::Queue.all.map(&:name)
10
+ @wrks = {}
11
11
 
12
12
  if params[:queue]
13
- @queue = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
14
- @workers[@queue.name] = Hash.new(0)
15
- @queue.each do |job|
16
- @workers[@queue.name][job.klass] += 1
13
+ @q = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
14
+ @wrks[@q.name] = Hash.new(0)
15
+ @q.each do |job|
16
+ @wrks[@q.name][job.klass] += 1
17
17
  end
18
18
  else
19
19
  Sidekiq::Queue.all.each do |q|
20
- @workers[q.name] = Hash.new(0)
20
+ @wrks[q.name] = Hash.new(0)
21
21
  q.each do |job|
22
- @workers[q.name][job.klass] += 1
22
+ @wrks[q.name][job.klass] += 1
23
23
  end
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-queue-stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Stephens