sidekiq-queue-stats 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +15 -0
- data/lib/sidekiq-queue-stats.rb +21 -0
- data/lib/sidekiq/queue_stats.rb +1 -0
- data/lib/sidekiq/queue_stats/configuration.rb +11 -0
- data/lib/sidekiq/queue_stats/version.rb +1 -1
- data/lib/sidekiq/queue_stats/views/queue_stats.erb +4 -2
- data/lib/sidekiq/queue_stats/web_extension.rb +7 -3
- data/test/web_extension_test.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01738da19e87612e68bfe8074757d052f034c850
|
4
|
+
data.tar.gz: adcfeca22ffb4173f404194022f002d5a5179eec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8c5f427fade4a363bfdb13b0facf72cd8af1256adb3c09769d9573c15b8d77ca3e56a213631ffd919ce735e2e9d56e6e46e3da4dc93dc35c41eecef6feec654
|
7
|
+
data.tar.gz: 13d186b3597892cbc6065195ddb1f4371d414826266870217c38dd54119366c24aaae663ee34689620e5f16b46a5c88237ef128c4e4c406ebfe0d5143ef3c288
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,6 +16,21 @@ Simply having the gem in your Gemfile is enough to get you started. Your
|
|
16
16
|
job count will be visible via a Queue Stats tab in the Web UI.
|
17
17
|
|
18
18
|
![Web UI](http://i.imgur.com/eSNVK0O.png)
|
19
|
+
|
20
|
+
### Configuration
|
21
|
+
|
22
|
+
Add this block to `config/initializers/sidekiq.rb`
|
23
|
+
|
24
|
+
```
|
25
|
+
Sidekiq::QueueStats.configure do |config|
|
26
|
+
config.max_limit = 50000
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
#### Max Limit
|
31
|
+
|
32
|
+
Iterating through large queues can be resource intensive and take quite a lot of time. This option lets you set an integer to only show queue stats of queues under a pre defined threashold.
|
33
|
+
|
19
34
|
## Dependencies
|
20
35
|
|
21
36
|
Depends on Sidekiq >= 2.16.0
|
data/lib/sidekiq-queue-stats.rb
CHANGED
@@ -1 +1,22 @@
|
|
1
1
|
require "sidekiq/queue_stats"
|
2
|
+
require 'sidekiq/queue_stats/configuration'
|
3
|
+
|
4
|
+
module Sidekiq
|
5
|
+
module QueueStats
|
6
|
+
class << self
|
7
|
+
attr_accessor :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configuration
|
11
|
+
@configuration ||= Configuration.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.reset
|
15
|
+
@configuration = Configuration.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configure
|
19
|
+
yield(configuration)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/sidekiq/queue_stats.rb
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
<% @workers_count[@selected_queue.name].each do |worker| %>
|
35
35
|
<tr>
|
36
36
|
<td><%=worker.first%></td>
|
37
|
-
<td><%=worker.last%></td>
|
37
|
+
<td><%=number_with_delimiter(worker.last)%></td>
|
38
38
|
</tr>
|
39
39
|
<% end %>
|
40
40
|
</table>
|
@@ -47,6 +47,8 @@
|
|
47
47
|
<h4><%= q.capitalize %></h4>
|
48
48
|
<% if @workers_count[q].empty? %>
|
49
49
|
<div class="alert alert-success">Nothing waiting in queue</div>
|
50
|
+
<% elsif @workers_count[q] == "too_big" %>
|
51
|
+
<div class="alert alert-warning">Queue too large to display. Manually select it to see what is in it.</div>
|
50
52
|
<% else %>
|
51
53
|
<table class="table table-striped table-bordered table-white">
|
52
54
|
<thead>
|
@@ -58,7 +60,7 @@
|
|
58
60
|
<% @workers_count[q].each do |worker| %>
|
59
61
|
<tr>
|
60
62
|
<td><%=worker.first%></td>
|
61
|
-
<td><%=worker.last%></td>
|
63
|
+
<td><%=number_with_delimiter(worker.last)%></td>
|
62
64
|
</tr>
|
63
65
|
<% end %>
|
64
66
|
</table>
|
@@ -18,9 +18,13 @@ module QueueStats
|
|
18
18
|
else
|
19
19
|
queues_list = Sidekiq::Queue.all
|
20
20
|
queues_list.each do |q|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
if !Sidekiq::QueueStats.configuration.max_limit.nil? && q.size > Sidekiq::QueueStats.configuration.max_limit
|
22
|
+
@workers_count[q.name] = "too_big"
|
23
|
+
else
|
24
|
+
@workers_count[q.name] = Hash.new(0)
|
25
|
+
q.each do |job|
|
26
|
+
@workers_count[q.name][job.klass] += 1
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
data/test/web_extension_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-queue-stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Stephens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- Rakefile
|
97
97
|
- lib/sidekiq-queue-stats.rb
|
98
98
|
- lib/sidekiq/queue_stats.rb
|
99
|
+
- lib/sidekiq/queue_stats/configuration.rb
|
99
100
|
- lib/sidekiq/queue_stats/version.rb
|
100
101
|
- lib/sidekiq/queue_stats/views/queue_stats.erb
|
101
102
|
- lib/sidekiq/queue_stats/web_extension.rb
|