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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90778b82350fe90c8075debd74da49daa9e46c8e
4
- data.tar.gz: 3242faefb11ae2f270b83ece04a2db40feece446
3
+ metadata.gz: a0f7f4e39e47ad5ed8cc5a612484bb716468d1be
4
+ data.tar.gz: 2444984302c6938c8af2bbd466a1ff34fd57f4a1
5
5
  SHA512:
6
- metadata.gz: 51dd3b8133a91a266afc68348c081365d9f89c1b8386a6f79a2797252c27f99889e20666aa9ce2ab7b10868b7700160d5cc10c6a31e1669f1cff383de331b909
7
- data.tar.gz: b910d345e31326f3b72e247c47fd0c430730df0017279f06ba9862f52593471fc5c28c605752d63b0d87ebaff039a487266c3a2c0f3bb1d01534be72da441e57
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 queue lengths and the number
4
- of Resque workers currently working to AWS Cloudwatch. In addition, it can (optionally)
5
- submit this metric to Graphite.
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 `jobs_queued` and `workers_working` in this gem), and any
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ResqueToCloudwatch
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  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.3.0
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-01-22 00:00:00.000000000 Z
11
+ date: 2014-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler