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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51e57c307b05076c0fbff272ff625e063eb14365
|
4
|
+
data.tar.gz: 106453857a501e1a0d20a395b3ca3e7573ede51f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60d1d2482649a54b3204dda12cbbac5c31d72695c9a7a85edf934473526c2b5991792fd4a5d5a7134829c4fb85054b874a28e3d3cec7e07c6c671c1030504086
|
7
|
+
data.tar.gz: 0de12313c8889f37d8af4311d7645b9b151b0e1fa2e6a772b485002d94f8f6638234287e495fbdbd4651654a1452f6ef76fc7aed9d2540a5d8403aceba951f16
|
@@ -1,26 +1,27 @@
|
|
1
1
|
<header class="row">
|
2
|
-
<div class="col-sm-
|
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
|
-
|
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><%= @
|
23
|
-
<% if @
|
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
|
-
<% @
|
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
|
-
<% @
|
43
|
-
<
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
@
|
10
|
-
@
|
9
|
+
@qs = Sidekiq::Queue.all.map(&:name)
|
10
|
+
@wrks = {}
|
11
11
|
|
12
12
|
if params[:queue]
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
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
|
-
@
|
20
|
+
@wrks[q.name] = Hash.new(0)
|
21
21
|
q.each do |job|
|
22
|
-
@
|
22
|
+
@wrks[q.name][job.klass] += 1
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|