resque_to_cloudwatch 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/bin/resque_to_cloudwatch +1 -0
- data/lib/resque_to_cloudwatch/collectors.rb +27 -0
- data/lib/resque_to_cloudwatch/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fc3b810372ceffa2d16fccc2c8d3ce1d2d38d17
|
4
|
+
data.tar.gz: 2705f78f1c27f9e02ec015434f9cd0f4ff586547
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2bd78c8146f614c2717aa78abfc329d78d967581bc077cf28cac2947b57ebde695b5621b336bd2cb8f8e3dcd76d9a564494b210b798ec10732b60e6630df014
|
7
|
+
data.tar.gz: 28b8617c624eb9b685e6a1d0788d8c3da0ad001229d97fa24975572b0079bb0af00bc108887d22728450523c2aed63253a95e2bb7a18628dda76b3cf4b179d3b
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ It collects and pushes the following metrics:
|
|
7
7
|
* number of jobs in all Resque queues (`resque_queues`)
|
8
8
|
* number of workers currently working (`resque_workers_working`)
|
9
9
|
* number of workers currently alive (`resque_workers_alive`)
|
10
|
+
* work remaining, which is workers working + queue length (`resque_work_remaining`)
|
10
11
|
|
11
12
|
## Usage
|
12
13
|
|
data/bin/resque_to_cloudwatch
CHANGED
@@ -30,6 +30,7 @@ collectors = []
|
|
30
30
|
collectors << ResqueToCloudwatch::QueueLengthCollector.new(config)
|
31
31
|
collectors << ResqueToCloudwatch::WorkersWorkingCollector.new(config)
|
32
32
|
collectors << ResqueToCloudwatch::WorkersAliveCollector.new(config)
|
33
|
+
collectors << ResqueToCloudwatch::WorkRemainingCollector.new(config)
|
33
34
|
$log.info "Collectors in use: #{collectors.join(", ")}"
|
34
35
|
|
35
36
|
|
@@ -66,4 +66,31 @@ module ResqueToCloudwatch
|
|
66
66
|
|
67
67
|
end
|
68
68
|
|
69
|
+
class WorkRemainingCollector
|
70
|
+
|
71
|
+
def initialize(config)
|
72
|
+
@config = config
|
73
|
+
end
|
74
|
+
|
75
|
+
def get_value
|
76
|
+
redis = Redis.new(:host => @config.redis_host, :port => @config.redis_port)
|
77
|
+
working = redis.smembers('resque:workers').select do |worker_key|
|
78
|
+
redis.exists("resque:worker:#{worker_key}")
|
79
|
+
end.length
|
80
|
+
queue_length = redis.smembers('resque:queues').map do |queue_key|
|
81
|
+
redis.llen("resque:queue:#{queue_key}")
|
82
|
+
end.reduce(:+)
|
83
|
+
working + queue_length
|
84
|
+
end
|
85
|
+
|
86
|
+
def metric_name
|
87
|
+
"resque_work_remaining"
|
88
|
+
end
|
89
|
+
|
90
|
+
def to_s
|
91
|
+
metric_name
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
69
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_to_cloudwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Sykes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.2.2
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Submit Resque queue lengths to AWS Cloudwatch
|