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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acc825c244c5b16fcd792fb39fe89785710cdcc5aa08c43cf082cda2200fada4
|
4
|
+
data.tar.gz: eef5bd9df19b6d13dcf8a2ec4d0b0dcbc1fab97d4822854408031aac0cb9e01b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bd61f9092d0619f54c5f47056372511e0735ad75b0ce936ed9b4393d2d636734d10a95a5d1774111aa1efb60029c950d0982b43e72a5d0fa2e4da9c41645510
|
7
|
+
data.tar.gz: e92a0955168e84c4d5eb6cc3c586b647ef0acdf5c99457ada45312cad53ab088be05115e372bdd8e09cc178562f0194b495c7e1d8019d98edcb5b5b86a0f7a00
|
data/Gemfile.lock
CHANGED
data/lib/cloudwatch_metrics.rb
CHANGED
@@ -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 =
|
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
|