cloudwatch-metrics 0.1.11 → 0.1.12

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
  SHA256:
3
- metadata.gz: dce097d501539877de89d8451ef1c4f3fe2a96cbaebee60a06292b733696e30d
4
- data.tar.gz: c65b336e84a4ed3c6c185b582e1e3488e2e95edfd01dab02f7a7d68c3e084e04
3
+ metadata.gz: acc825c244c5b16fcd792fb39fe89785710cdcc5aa08c43cf082cda2200fada4
4
+ data.tar.gz: eef5bd9df19b6d13dcf8a2ec4d0b0dcbc1fab97d4822854408031aac0cb9e01b
5
5
  SHA512:
6
- metadata.gz: 5decfcc8b1023d215c7771e3548888f6c3c5cddca8f23eee819d258b811ec3b1cca4c30114da6a9cf02312b1bcc1b6034477509539e40b41c83c7e47069c2bef
7
- data.tar.gz: 386f21b0c4efe665d3b01963c9ffc236b9e9c4a22bd33d2f0f651b25076cac4bfde3ce9e985791074b28ee97c0296ee69fd6472a9c5c9e32243a82ea87edcc88
6
+ metadata.gz: 2bd61f9092d0619f54c5f47056372511e0735ad75b0ce936ed9b4393d2d636734d10a95a5d1774111aa1efb60029c950d0982b43e72a5d0fa2e4da9c41645510
7
+ data.tar.gz: e92a0955168e84c4d5eb6cc3c586b647ef0acdf5c99457ada45312cad53ab088be05115e372bdd8e09cc178562f0194b495c7e1d8019d98edcb5b5b86a0f7a00
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudwatch-metrics (0.1.7)
4
+ cloudwatch-metrics (0.1.11)
5
5
  aws-sdk-cloudwatch (~> 1.73)
6
6
  rake (~> 13.0)
7
7
  rspec (~> 3.0)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CloudwatchMetrics
4
4
  class Configuration
5
- attr_accessor :namespace
5
+ attr_accessor :namespace, :region
6
6
  attr_writer :no_cw_alias
7
7
 
8
8
  def no_cw_alias
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudwatchMetrics
4
- VERSION = "0.1.11"
4
+ VERSION = '0.1.12'
5
5
  end
@@ -7,18 +7,10 @@ module CloudwatchMetrics
7
7
  class Error < StandardError; end
8
8
 
9
9
  class << self
10
- def configuration
11
- @configuration ||= Configuration.new
12
- end
13
-
14
10
  def configure
15
11
  yield(configuration)
16
12
  end
17
13
 
18
- def hi
19
- puts "Hello, #{configuration.namespace}"
20
- end
21
-
22
14
  def record(
23
15
  metric_name:, value:, unit: nil, namespace: configuration.namespace, dimensions: [], timestamp: nil
24
16
  )
@@ -48,8 +40,16 @@ module CloudwatchMetrics
48
40
 
49
41
  private
50
42
 
43
+ def configuration
44
+ @configuration ||= Configuration.new
45
+ end
46
+
47
+ def cloudwatch_client
48
+ @cloudwatch_client ||= Aws::CloudWatch::Client.new(region: configuration.region)
49
+ end
50
+
51
51
  def put_data(namespace:, metric_data:)
52
- resp = @cloudwatch_client.put_metric_data({
52
+ resp = cloudwatch_client.put_metric_data({
53
53
  namespace: namespace,
54
54
  metric_data: metric_data
55
55
  })
@@ -11,4 +11,9 @@ CloudwatchMetrics.configure do |config|
11
11
  # `CW` alias. This is useful if you have a constant named `CW` that
12
12
  # conflicts with the alias. Default is `false`.
13
13
  # config.no_cw_alias = true
14
+
15
+ # This is an optional configuration to set the region that
16
+ # the metrics will be published to. This is useful if you want to publish
17
+ # to a region other than the default region for your AWS credentials.
18
+ # config.region = 'us-east-1'
14
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudwatch-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Puckett