resque-http_stats 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/resque/http_stats.rb +20 -12
- data/lib/resque/http_stats/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be089bb10e2cb7e8a10c587ee846d78386b54ca7
|
4
|
+
data.tar.gz: 4462cfa40c813fdd32d1a35f91243c4bad02d532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50f6f1e14a8f460599e07114a88fe20e084aa26f7bcbab1125de3eeab4c127d027301d5835be13a5639ee5d4eb5252438880273b22235a8452ba626fb0964504
|
7
|
+
data.tar.gz: 552fffe6325be86e92c4c2135d3ef4198e36630683ddbb710049b63e5685a4e7c1b1a25a7cbc073cbb05922b5c062f12c637789fd5c728d7cd4a9c1435649078
|
data/lib/resque/http_stats.rb
CHANGED
@@ -1,20 +1,27 @@
|
|
1
|
-
require "resque/http_stats/version"
|
2
|
-
require 'json'
|
3
|
-
|
4
1
|
module Resque
|
5
2
|
module HttpStats
|
6
3
|
def self.call(env)
|
7
4
|
info = Resque.info
|
5
|
+
failed_queues = Resque::Failure.all(0, Resque::Failure.count).inject(Hash.new(0)) do |res, f|
|
6
|
+
res[f['queue']] += 1
|
7
|
+
res
|
8
|
+
end
|
9
|
+
|
10
|
+
queues = Resque.queues.inject({}) do |res, q|
|
11
|
+
res[q] = {
|
12
|
+
in_queue: Resque.size(q),
|
13
|
+
failed: failed_queues[q],
|
14
|
+
}
|
15
|
+
res
|
16
|
+
end
|
17
|
+
|
8
18
|
stats = { resque: {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
res[q] = Resque.size(q)
|
16
|
-
res
|
17
|
-
end
|
19
|
+
processed: info[:processed],
|
20
|
+
failed: info[:failed],
|
21
|
+
pending: info[:pending],
|
22
|
+
workers: info[:workers],
|
23
|
+
working: info[:working],
|
24
|
+
queues: queues
|
18
25
|
}}
|
19
26
|
|
20
27
|
[
|
@@ -27,3 +34,4 @@ module Resque
|
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
37
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-http_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- skv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|