resque-cloudwatch-metrics 0.2.0 → 0.3.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: 35f370eb016eaf0a9b1393edb97933e50ad328c6
4
- data.tar.gz: ca1e50cac0cbe1a44c193604f1df6d76eb368247
3
+ metadata.gz: 733c1beb5e744c021fd6367622aa79aa5f9c0ad7
4
+ data.tar.gz: 93cca39a1c74279ed2b35ed394f59895dd51289d
5
5
  SHA512:
6
- metadata.gz: adeaa94b383ce7a2ca7a3627d51adaebfaf80acdd56e50d8301b12ee7a99bc163bb6789606d6266fb42b1f5fc8ea4d1e5be53d918b5f171043c99266e76ff4a1
7
- data.tar.gz: bc5251942a12c395e55f824129e945ebcc98a1cac05c3946ce4fbacc8bb737d2646a80bb43c090ae9cd8d32ad6cfb7b69c2fc58b9709ad49a0763c2f820177a5
6
+ metadata.gz: f824a25e5cef1afe76edfbbbc4a04754caa044fb206731e5f4fffd1ae13454b0202716d7a3f487ffbe39dcacb7cc6d783cb5d486141b1b0710ff71a6f62dd889
7
+ data.tar.gz: 98b97cf81fa69c0b6ef21a73fedcedbd78937871d3e057a58ce610026856a3a444ef90c422c8e3480f9841ca232241d9b08883ebad5f21a3a69db5688be9151d
data/docker/Gemfile.lock CHANGED
@@ -20,7 +20,7 @@ GEM
20
20
  redis-namespace (~> 1.3)
21
21
  sinatra (>= 0.9.2)
22
22
  vegas (~> 0.1.2)
23
- resque-cloudwatch-metrics (0.2.0)
23
+ resque-cloudwatch-metrics (0.3.0)
24
24
  aws-sdk-core (~> 2)
25
25
  resque (~> 1)
26
26
  sinatra (1.4.7)
@@ -56,15 +56,17 @@ module Resque
56
56
  def workers; @info[:workers]; end
57
57
  def working; @info[:working]; end
58
58
 
59
+ def not_working
60
+ [0, workers - working].max
61
+ end
62
+
59
63
  def processing
60
64
  incremental_size_of_processed + working
61
65
  end
62
66
 
63
67
  def to_cloudwatch_metric_data
64
- dimensions = [{ name: 'namespace', value: @namespace.to_s }]
65
-
66
- %i(pending processed failed queues workers working processing).map do |key|
67
- build_cloudwatch_metric_datum(key.to_s.capitalize, public_send(key))
68
+ %i(pending processed failed queues workers working not_working processing).map do |key|
69
+ build_cloudwatch_metric_datum(camelize(key.to_s), public_send(key))
68
70
  end +
69
71
  @queue_sizes.map do |name, size|
70
72
  build_cloudwatch_metric_datum('Pending', size, queue: name)
@@ -94,6 +96,10 @@ module Resque
94
96
  [0, processed - @previous_processed].max
95
97
  end
96
98
  end
99
+
100
+ def camelize(string)
101
+ string.gsub(/(?:^|_)(.)/) { $1.upcase }
102
+ end
97
103
  end
98
104
 
99
105
  class Dimensions < Hash
@@ -3,7 +3,7 @@
3
3
  module Resque
4
4
  module CloudWatch
5
5
  class Metrics
6
- VERSION = '0.2.0'
6
+ VERSION = '0.3.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-cloudwatch-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Takeuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-26 00:00:00.000000000 Z
11
+ date: 2016-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core