sidekiq-worker-stats 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -8
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/lib/sidekiq/worker_stats/version.rb +1 -1
- data/lib/sidekiq/worker_stats/views/worker_stats.erb +25 -0
- data/lib/sidekiq/worker_stats/web_extension.rb +12 -0
- data/test/test_helper.rb +2 -8
- data/test/web_extension_test.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c122618cce95df1122b43e01959cf1c1c57e3aba
|
4
|
+
data.tar.gz: 0731d9a5c1cf8fbb28de6a5c695b82a3610fe2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82d6dc4890f8ec2e5f40657ebae8db9fe314e4718581de73535529fffa8d2dbb912ceb26117ec36cf2fa4e0bb73f65059481c885b406b677a2ac3020fc96a131
|
7
|
+
data.tar.gz: d98fd137be342db47e7bee89bd3f6d605e49839c18c37f8aa9a69d5a107b773c6688d3bca5b5f8b2a57aa5d9784c5d5888aa161c91189d6ac08e060d1cb6b84d
|
data/.travis.yml
CHANGED
@@ -2,17 +2,10 @@ language: ruby
|
|
2
2
|
services:
|
3
3
|
- redis-server
|
4
4
|
rvm:
|
5
|
-
-
|
6
|
-
- jruby-19mode
|
7
|
-
- 2.0.0
|
8
|
-
- 2.1
|
5
|
+
- 2.3.1
|
9
6
|
env:
|
10
7
|
matrix:
|
11
8
|
- SIDEKIQ_VERSION="~> 2.16"
|
12
9
|
- SIDEKIQ_VERSION="~> 2.17"
|
13
10
|
- SIDEKIQ_VERSION="~> 3.0"
|
14
11
|
- SIDEKIQ_VERSION="~> 3.1"
|
15
|
-
matrix:
|
16
|
-
allow_failures:
|
17
|
-
- rvm: 1.9.3
|
18
|
-
- rvm: jruby-19mode
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Sidekiq::WorkerStats [![Build Status](https://
|
1
|
+
# Sidekiq::WorkerStats [![Build Status](https://travis-ci.org/mikestephens/sidekiq-worker-stats.svg?branch=master)](https://travis-ci.org/mikestephens/sidekiq-worker-stats)
|
2
2
|
|
3
3
|
Keeps track of Sidekiq job count and adds a tab to the Web UI to let you view totals.
|
4
4
|
|
@@ -10,6 +10,7 @@
|
|
10
10
|
<span class="caret"></span>
|
11
11
|
</button>
|
12
12
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
13
|
+
<li><a href="?queue=all">All</a></li>
|
13
14
|
<% @queues.each do |q| %>
|
14
15
|
<li><a href=<%="?queue=#{q.downcase}"%>><%= q.capitalize %></a></li>
|
15
16
|
<% end %>
|
@@ -36,3 +37,27 @@
|
|
36
37
|
<% end %>
|
37
38
|
</table>
|
38
39
|
<% end %>
|
40
|
+
|
41
|
+
<% if params[:queue] == "all" %>
|
42
|
+
<% @queues.each do |q| %>
|
43
|
+
<h4><%= q.capitalize %></h4>
|
44
|
+
<% if @workers[q].nil? %>
|
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>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>
|
61
|
+
<% end %>
|
62
|
+
<% end %>
|
63
|
+
<% end %>
|
@@ -9,6 +9,17 @@ module Sidekiq
|
|
9
9
|
@queues = Sidekiq::Queue.all.map(&:name)
|
10
10
|
@queue = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
|
11
11
|
@workers = {}
|
12
|
+
|
13
|
+
if params[:queue] == "all"
|
14
|
+
Sidekiq::Queue.all.each do |q|
|
15
|
+
@workers[q.name] = {}
|
16
|
+
total = q.map{|cue| cue.klass}
|
17
|
+
klasses = total.uniq
|
18
|
+
klasses.each do |klass|
|
19
|
+
@workers[q.name][klass] = total.count(klass)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
else
|
12
23
|
@queue.each do |q|
|
13
24
|
@workers[q.name] = {}
|
14
25
|
total = q.map{|cue| cue.klass}
|
@@ -17,6 +28,7 @@ module Sidekiq
|
|
17
28
|
@workers[q.name][klass] = total.count(klass)
|
18
29
|
end
|
19
30
|
end
|
31
|
+
end
|
20
32
|
|
21
33
|
render(:erb, File.read(File.join(view_path, "worker_stats.erb")))
|
22
34
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,20 +1,14 @@
|
|
1
|
-
Encoding.default_external = Encoding::UTF_8
|
2
|
-
Encoding.default_internal = Encoding::UTF_8
|
3
|
-
|
4
1
|
require "minitest/autorun"
|
5
2
|
require "minitest/spec"
|
6
3
|
require "minitest/mock"
|
7
|
-
|
8
4
|
require "rack/test"
|
9
5
|
|
10
|
-
require "celluloid"
|
11
6
|
require "sidekiq"
|
12
|
-
require "sidekiq-
|
7
|
+
require "sidekiq-worker-stats"
|
13
8
|
require "sidekiq/processor"
|
14
9
|
require "sidekiq/fetch"
|
15
10
|
require "sidekiq/cli"
|
16
11
|
|
17
|
-
Celluloid.logger = nil
|
18
12
|
Sidekiq.logger.level = Logger::ERROR
|
19
13
|
|
20
|
-
REDIS = Sidekiq::RedisConnection.create(:
|
14
|
+
REDIS = Sidekiq::RedisConnection.create(url: "redis://localhost/15")
|
data/test/web_extension_test.rb
CHANGED