resque_to_cloudwatch 1.5.0 → 1.6.0
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 +4 -4
- data/README.md +4 -2
- data/lib/resque_to_cloudwatch/cloudwatch_sender.rb +16 -14
- data/lib/resque_to_cloudwatch/config.rb +5 -2
- 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: b0cbb88c9e477cfef634c0bd27d2fe1dbaee7f42
|
4
|
+
data.tar.gz: 3db4b493c7deea434c26f60350454a1bb5d98617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c70d6a2ff6bece035048d03f9a5780f1cbec137f96d9b9c6dac1eac2c77cefa01ac42db67c5ac6ee67289ca94694c31896d435d5e6a6683c12acbe13fd4a7fcc
|
7
|
+
data.tar.gz: 4faf447f1b8ae61d8c39316848f134b5cbc38e5a59d0406a3350675f6b6ab65eea5830c2bd3dd223e11cfc4490bd29d8da69e54d61670f481bd514704660a6d1
|
data/README.md
CHANGED
@@ -24,7 +24,8 @@ The config file has the following format (in YAML):
|
|
24
24
|
|
25
25
|
access_key_id: asdfasfasd
|
26
26
|
secret_access_key: asdfasdfasf
|
27
|
-
region:
|
27
|
+
region:
|
28
|
+
- us-west-2
|
28
29
|
project: testing
|
29
30
|
hostname: laptop
|
30
31
|
redis_host: some.redis.host
|
@@ -38,7 +39,8 @@ Your AWS access key/secret key pair.
|
|
38
39
|
|
39
40
|
#### `region`
|
40
41
|
|
41
|
-
Region of Cloudwatch the metrics should be submitted to.
|
42
|
+
Region(s) of Cloudwatch the metrics should be submitted to. This can either be a string, or
|
43
|
+
a list of regions to send the metric to.
|
42
44
|
|
43
45
|
#### `project`, `namespace`, `hostname`
|
44
46
|
|
@@ -9,20 +9,22 @@ module ResqueToCloudwatch
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def send_value(value, metric_name)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
@config.region.each do |region|
|
13
|
+
dimensions = []
|
14
|
+
dimensions << {:name => 'project', :value => @config.project}
|
15
|
+
dimensions << {:name => 'hostname', :value => @config.hostname} unless @config.hostname.nil?
|
16
|
+
cw = AWS::CloudWatch.new(region: region)
|
17
|
+
cw.client.put_metric_data({
|
18
|
+
:namespace => "#{@config.namespace}/resque",
|
19
|
+
:metric_data => [
|
20
|
+
:metric_name => metric_name,
|
21
|
+
:dimensions => dimensions,
|
22
|
+
:value => value,
|
23
|
+
:unit => 'Count'
|
24
|
+
]
|
25
|
+
})
|
26
|
+
$log.info "CloudwatchSender: Sent metric value #{value} for #{metric_name} to region #{region}"
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
def inspect
|
@@ -17,6 +17,10 @@ module ResqueToCloudwatch
|
|
17
17
|
raise "Config file #{path} is empty" unless @hash
|
18
18
|
validate_config
|
19
19
|
@hash.each_pair do |opt,value|
|
20
|
+
# Support old-style where region is not an array
|
21
|
+
if opt == 'region' && value.is_a?(String)
|
22
|
+
value = [value]
|
23
|
+
end
|
20
24
|
instance_variable_set("@#{opt}", value)
|
21
25
|
$log.info "Config parameter: #{opt} is #{value}"
|
22
26
|
end
|
@@ -24,8 +28,7 @@ module ResqueToCloudwatch
|
|
24
28
|
# Set up AWS credentials
|
25
29
|
AWS.config(
|
26
30
|
:access_key_id => @hash['access_key_id'],
|
27
|
-
:secret_access_key => @hash['secret_access_key']
|
28
|
-
:region => @hash['region']
|
31
|
+
:secret_access_key => @hash['secret_access_key']
|
29
32
|
)
|
30
33
|
end
|
31
34
|
|
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.6.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-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|