resque-http_stats 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41b6ef81ec81a60812a705ff88e7ad185524dd0e
4
- data.tar.gz: 838a9c3855c7e3e537ae76df89a49b55c25be819
3
+ metadata.gz: be089bb10e2cb7e8a10c587ee846d78386b54ca7
4
+ data.tar.gz: 4462cfa40c813fdd32d1a35f91243c4bad02d532
5
5
  SHA512:
6
- metadata.gz: 01a5b5dd2ffbeec54a2eae12f922de00f9dcbcfd07ca7ccb53128d92af7b62a2f76b8c62b83bc2080e7b63448469ea9cdd8871012819e01cf8068013005e6193
7
- data.tar.gz: 69b99cf8790fd5d2056de51807641e7c2e50a476add53eaf91bd82cec50c40b05cb1c40f36bff76d25e4d6e4971144f7efa676950605b8b2467902c67d5e0f3f
6
+ metadata.gz: 50f6f1e14a8f460599e07114a88fe20e084aa26f7bcbab1125de3eeab4c127d027301d5835be13a5639ee5d4eb5252438880273b22235a8452ba626fb0964504
7
+ data.tar.gz: 552fffe6325be86e92c4c2135d3ef4198e36630683ddbb710049b63e5685a4e7c1b1a25a7cbc073cbb05922b5c062f12c637789fd5c728d7cd4a9c1435649078
@@ -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
- processed: info[:processed],
10
- failed: info[:failed],
11
- pending: info[:pending],
12
- workers: info[:workers],
13
- working: info[:working],
14
- queues: Resque.queues.inject({}) do |res, q|
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
+
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module HttpStats
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
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.0
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-30 00:00:00.000000000 Z
11
+ date: 2014-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler