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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08db32267957270f87358293679314a435e4101e
4
- data.tar.gz: 07a10d922c29af634224ebb0765e1214b2f14573
3
+ metadata.gz: c122618cce95df1122b43e01959cf1c1c57e3aba
4
+ data.tar.gz: 0731d9a5c1cf8fbb28de6a5c695b82a3610fe2ca
5
5
  SHA512:
6
- metadata.gz: dbdae23927fcb82cce672dcc8af3f6c2db0cd77cd952130f44ef79f29d7a5e2fd03d16c0db4733f88c6b1bf528f6f650f578512a493483bdb7aab86398d27a1a
7
- data.tar.gz: 41b09daf7ff631672295cb072833d1e4916e1672612915738e7070e451868257302cee106c1fbc3b9ccd561cdb603bcc7a89b4b674a65f0620bcc4e5be2d905c
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
- - 1.9.3
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
@@ -4,3 +4,4 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'sidekiq', ENV['SIDEKIQ_VERSION'] if ENV['SIDEKIQ_VERSION']
7
+ gem 'minitest'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Sidekiq::WorkerStats [![Build Status](https://secure.travis-ci.org/mhfs/sidekiq-worker-count.png)](http://travis-ci.org/mhfs/sidekiq-worker-count)
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
 
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module WorkerStats
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -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-failures"
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(:url => "redis://localhost/15", :namespace => 'sidekiq_failures_test')
14
+ REDIS = Sidekiq::RedisConnection.create(url: "redis://localhost/15")
@@ -16,7 +16,6 @@ module Sidekiq
16
16
 
17
17
  it 'can display home with worker stats tab' do
18
18
  get '/'
19
-
20
19
  last_response.status.must_equal 200
21
20
  last_response.body.must_match /Sidekiq/
22
21
  last_response.body.must_match /Worker Stats/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-worker-stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Stephens