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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fc3b810372ceffa2d16fccc2c8d3ce1d2d38d17
4
- data.tar.gz: 2705f78f1c27f9e02ec015434f9cd0f4ff586547
3
+ metadata.gz: b0cbb88c9e477cfef634c0bd27d2fe1dbaee7f42
4
+ data.tar.gz: 3db4b493c7deea434c26f60350454a1bb5d98617
5
5
  SHA512:
6
- metadata.gz: b2bd78c8146f614c2717aa78abfc329d78d967581bc077cf28cac2947b57ebde695b5621b336bd2cb8f8e3dcd76d9a564494b210b798ec10732b60e6630df014
7
- data.tar.gz: 28b8617c624eb9b685e6a1d0788d8c3da0ad001229d97fa24975572b0079bb0af00bc108887d22728450523c2aed63253a95e2bb7a18628dda76b3cf4b179d3b
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: us-west-2
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
- dimensions = []
13
- dimensions << {:name => 'project', :value => @config.project}
14
- dimensions << {:name => 'hostname', :value => @config.hostname} unless @config.hostname.nil?
15
- cw = AWS::CloudWatch.new
16
- cw.client.put_metric_data({
17
- :namespace => "#{@config.namespace}/resque",
18
- :metric_data => [
19
- :metric_name => metric_name,
20
- :dimensions => dimensions,
21
- :value => value,
22
- :unit => 'Count'
23
- ]
24
- })
25
- $log.info "CloudwatchSender: Sent metric value #{value} for #{metric_name}"
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
 
@@ -1,3 +1,3 @@
1
1
  module ResqueToCloudwatch
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.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.5.0
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-05-20 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler