resque_to_cloudwatch 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/README.md +10 -6
- data/bin/resque_to_cloudwatch +1 -0
- data/lib/resque_to_cloudwatch/collectors.rb +21 -0
- data/lib/resque_to_cloudwatch/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: a0f7f4e39e47ad5ed8cc5a612484bb716468d1be
|
4
|
+
data.tar.gz: 2444984302c6938c8af2bbd466a1ff34fd57f4a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de1c8b16ba2e7b3068ec9b40dda351debf2ed34531d54b8ca0ba4dfad709f5698769eaa7ef3d54fd4745b39a2b7e159cff2e3662e00d6716d1ae6e9ff90b9d3f
|
7
|
+
data.tar.gz: 43b72636da8419c9b308a7bb9edd6aa567c3a00bbe0c5476609076e2bff2ecb94979a050da5a4cdfa04d4c42547dab7a6048c5201564cc0ca7ed647c3f5adc1f
|
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# resque_to_cloudwatch
|
2
2
|
|
3
|
-
This is a gem containing a daemon for submitting Resque
|
4
|
-
|
5
|
-
|
3
|
+
This is a gem containing a daemon for submitting Resque metrics to
|
4
|
+
AWS Cloudwatch. In addition, it can (optionally) submit these metrics to Graphite.
|
5
|
+
|
6
|
+
It collects and pushes the following metrics:
|
7
|
+
* number of jobs in all Resque queues (`resque_queues`)
|
8
|
+
* number of workers currently working (`resque_workers_working`)
|
9
|
+
* number of workers currently alive (`resque_workers_alive`)
|
6
10
|
|
7
11
|
## Usage
|
8
12
|
|
@@ -39,11 +43,11 @@ Region of Cloudwatch the metrics should be submitted to.
|
|
39
43
|
|
40
44
|
These can actually contain any text - they are submitted as "dimensions" along
|
41
45
|
with the metric value. A single metric in Cloudwatch is uniquely identified by
|
42
|
-
its name (hardcoded to `
|
43
|
-
dimensions it has. At Forward3D, we have a number of autoscaling "projects"
|
46
|
+
its name (hardcoded to `resque_queues`, `resque_workers_working` and `resque_workers_alive`
|
47
|
+
in this gem), and any dimensions it has. At Forward3D, we have a number of autoscaling "projects"
|
44
48
|
(codebases), so we use the project dimension to represent that. Namespace is more
|
45
49
|
important, as that determines how the metric is categorised in the Cloudwatch interface.
|
46
|
-
Hostname can be anything - we set it to the hostname of the submitting machine.
|
50
|
+
Hostname can be anything, or blank - we set it to the hostname of the submitting machine.
|
47
51
|
|
48
52
|
#### `redis_host`, `redis_port`
|
49
53
|
|
data/bin/resque_to_cloudwatch
CHANGED
@@ -29,6 +29,7 @@ $log.info "Entering EventMachine loop with period of #{config.period} seconds"
|
|
29
29
|
collectors = []
|
30
30
|
collectors << ResqueToCloudwatch::QueueLengthCollector.new(config)
|
31
31
|
collectors << ResqueToCloudwatch::WorkersWorkingCollector.new(config)
|
32
|
+
collectors << ResqueToCloudwatch::WorkersAliveCollector.new(config)
|
32
33
|
$log.info "Collectors in use: #{collectors.join(", ")}"
|
33
34
|
|
34
35
|
|
@@ -45,4 +45,25 @@ module ResqueToCloudwatch
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
+
class WorkersAliveCollector
|
49
|
+
|
50
|
+
def initialize(config)
|
51
|
+
@config = config
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_value
|
55
|
+
redis = Redis.new(:host => @config.redis_host, :port => @config.redis_port)
|
56
|
+
redis.smembers('resque:workers').length
|
57
|
+
end
|
58
|
+
|
59
|
+
def metric_name
|
60
|
+
"resque_workers_alive"
|
61
|
+
end
|
62
|
+
|
63
|
+
def to_s
|
64
|
+
metric_name
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
48
69
|
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.4.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-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|