cloudwatch-metrics 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +335 -9
- data/.rubocop_strict.yml +23 -0
- data/README.md +40 -13
- data/lib/cloudwatch_metrics/configuration.rb +5 -0
- data/lib/cloudwatch_metrics/constants.rb +39 -0
- data/lib/cloudwatch_metrics/version.rb +1 -1
- data/lib/cloudwatch_metrics.rb +40 -1
- data/lib/generators/cloudwatch_metrics/templates/cloudwatch_metrics.rb +8 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e91c58bffeee53bb5b3272031f522133f2b3ec67ad0e1c75f81193026a4d5037
|
4
|
+
data.tar.gz: 742fa5b4f52be3918d782f390babb0f0c09fe819842aafbc82807d0df4d43790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0293109370d02b2ceb4d4395536336719f71bf99c974b470f2c359b134d8ec2b14432f1840da8f99cb4bac03eb51590445fe9e449aa942d79403f7f05cc5307
|
7
|
+
data.tar.gz: c7290bd824d12277457f388de3541926828f7cde2dc4441b74028b2f81dd9802cd965caa1482d82e0ef12d1e3ab1ef2c3cd61fc54668a58446d3a4de934257df
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,339 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_strict.yml
|
3
|
+
|
4
|
+
inherit_mode:
|
5
|
+
merge:
|
6
|
+
- Exclude
|
7
|
+
|
8
|
+
require:
|
9
|
+
- rubocop-rspec
|
10
|
+
- rubocop-performance
|
11
|
+
- rubocop-rails
|
12
|
+
|
13
|
+
## For Reference:
|
14
|
+
## Rubocop docs: https://docs.rubocop.org/
|
15
|
+
## Ruby Style Guide: https://rubystyle.guide/
|
16
|
+
## Rails Style Guide: https://rails.rubystyle.guide/
|
17
|
+
## RSpec Style Guide: https://rspec.rubystyle.guide/
|
18
|
+
|
1
19
|
AllCops:
|
2
|
-
|
20
|
+
TargetRubyVersion: 3.0.3
|
21
|
+
SuggestExtensions: false
|
22
|
+
NewCops: enable
|
23
|
+
Exclude:
|
24
|
+
- bin/**/*
|
25
|
+
- config/**/*
|
26
|
+
- db/seeds/**/*
|
27
|
+
- db/*
|
28
|
+
- node_modules/**/*
|
29
|
+
- vendor/**/*
|
30
|
+
- tmp/**/*
|
31
|
+
|
32
|
+
Layout/SpaceInsideHashLiteralBraces:
|
33
|
+
Enabled: true
|
34
|
+
EnforcedStyle: no_space
|
35
|
+
EnforcedStyleForEmptyBraces: no_space
|
36
|
+
|
37
|
+
Layout/MultilineMethodCallIndentation:
|
38
|
+
Enabled: true
|
39
|
+
EnforcedStyle: indented
|
40
|
+
|
41
|
+
Layout/ArrayAlignment:
|
42
|
+
Enabled: true
|
43
|
+
EnforcedStyle: with_fixed_indentation
|
44
|
+
|
45
|
+
Layout/FirstHashElementIndentation:
|
46
|
+
Enabled: true
|
47
|
+
EnforcedStyle: consistent
|
48
|
+
|
49
|
+
Style/NegatedIf:
|
50
|
+
Enabled: true
|
51
|
+
EnforcedStyle: postfix
|
52
|
+
|
53
|
+
Layout/FirstArgumentIndentation:
|
54
|
+
Enabled: true
|
55
|
+
EnforcedStyle: consistent
|
56
|
+
|
57
|
+
Layout/MultilineOperationIndentation:
|
58
|
+
Enabled: true
|
59
|
+
EnforcedStyle: indented
|
60
|
+
|
61
|
+
Layout/FirstArrayElementIndentation:
|
62
|
+
Enabled: true
|
63
|
+
EnforcedStyle: consistent
|
64
|
+
|
65
|
+
Style/HashSyntax:
|
66
|
+
Enabled: true
|
67
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
68
|
+
|
69
|
+
Style/EmptyMethod:
|
70
|
+
Enabled: true
|
71
|
+
EnforcedStyle: expanded
|
72
|
+
|
73
|
+
Style/RescueModifier:
|
74
|
+
Enabled: true
|
75
|
+
Exclude:
|
76
|
+
- spec/**/*
|
77
|
+
|
78
|
+
Rails/Output:
|
79
|
+
Enabled: true
|
80
|
+
Exclude:
|
81
|
+
- lib/**/*
|
82
|
+
- app/services/tasks/*
|
83
|
+
|
84
|
+
Rails/UnknownEnv:
|
85
|
+
Enabled: true
|
86
|
+
Environments:
|
87
|
+
- production
|
88
|
+
- staging
|
89
|
+
- test
|
90
|
+
- development
|
91
|
+
|
92
|
+
Metrics/BlockNesting:
|
93
|
+
Enabled: true
|
94
|
+
Max: 3
|
95
|
+
|
96
|
+
# Default Max: 10
|
97
|
+
Metrics/MethodLength:
|
98
|
+
Max: 20
|
99
|
+
CountAsOne: ['array', 'hash']
|
100
|
+
|
101
|
+
Metrics/ModuleLength:
|
102
|
+
Enabled: true
|
103
|
+
Max: 100
|
104
|
+
CountAsOne: ['array', 'hash']
|
105
|
+
|
106
|
+
Metrics/PerceivedComplexity:
|
107
|
+
Enabled: true
|
108
|
+
Max: 16
|
109
|
+
|
110
|
+
Metrics/ParameterLists:
|
111
|
+
Enabled: true
|
112
|
+
Max: 8
|
113
|
+
|
114
|
+
Style/Documentation:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
# Leave disabled in favor of Perceived/Complexity
|
118
|
+
Metrics/AbcSize:
|
119
|
+
Enabled: false
|
120
|
+
|
121
|
+
Style/ClassAndModuleChildren:
|
122
|
+
Enabled: false
|
123
|
+
|
124
|
+
Style/IfUnlessModifier:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
Naming/RescuedExceptionsVariableName:
|
128
|
+
Enabled: false
|
129
|
+
|
130
|
+
Style/InverseMethods:
|
131
|
+
Enabled: false
|
132
|
+
|
133
|
+
Style/StringConcatenation:
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
Style/HashEachMethods:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
Style/CaseLikeIf:
|
140
|
+
Enabled: false
|
141
|
+
|
142
|
+
# Leave disabled in favor of PerceivedComplexity
|
143
|
+
Metrics/CyclomaticComplexity:
|
144
|
+
Enabled: false
|
145
|
+
|
146
|
+
Style/Next:
|
147
|
+
Enabled: false
|
148
|
+
|
149
|
+
Layout/EmptyLineAfterGuardClause:
|
150
|
+
Enabled: false
|
151
|
+
|
152
|
+
Style/HashAsLastArrayItem:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Lint/ShadowingOuterLocalVariable:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Naming/AccessorMethodName:
|
159
|
+
Enabled: false
|
160
|
+
|
161
|
+
Style/IfWithBooleanLiteralBranches:
|
162
|
+
Enabled: false
|
163
|
+
|
164
|
+
Metrics/BlockLength:
|
165
|
+
Enabled: false
|
166
|
+
|
167
|
+
Style/NumericPredicate:
|
168
|
+
Enabled: false
|
169
|
+
|
170
|
+
Style/SoleNestedConditional:
|
171
|
+
Enabled: false
|
172
|
+
|
173
|
+
Style/GuardClause:
|
174
|
+
Enabled: false
|
175
|
+
|
176
|
+
Style/SymbolArray:
|
177
|
+
Enabled: false
|
178
|
+
|
179
|
+
Style/WordArray:
|
180
|
+
Enabled: false
|
181
|
+
|
182
|
+
Naming/VariableNumber:
|
183
|
+
Enabled: false
|
184
|
+
|
185
|
+
Naming/MethodParameterName:
|
186
|
+
Enabled: false
|
187
|
+
|
188
|
+
Lint/DuplicateBranch:
|
189
|
+
Enabled: false
|
190
|
+
|
191
|
+
Style/MultilineTernaryOperator:
|
192
|
+
Enabled: false
|
193
|
+
|
194
|
+
Naming/MemoizedInstanceVariableName:
|
195
|
+
Enabled: false
|
196
|
+
|
197
|
+
Style/SymbolProc:
|
198
|
+
Enabled: false
|
199
|
+
|
200
|
+
Lint/UselessAccessModifier:
|
201
|
+
Enabled: false
|
202
|
+
|
203
|
+
Lint/UselessMethodDefinition:
|
204
|
+
Enabled: false
|
205
|
+
|
206
|
+
Lint/EmptyBlock:
|
207
|
+
Enabled: false
|
208
|
+
|
209
|
+
Style/CaseEquality:
|
210
|
+
Enabled: false
|
211
|
+
|
212
|
+
Style/ExplicitBlockArgument:
|
213
|
+
Enabled: false
|
214
|
+
|
215
|
+
Lint/TripleQuotes:
|
216
|
+
Enabled: false
|
217
|
+
|
218
|
+
Style/ZeroLengthPredicate:
|
219
|
+
Enabled: false
|
220
|
+
|
221
|
+
Style/StringChars:
|
222
|
+
Enabled: false
|
223
|
+
|
224
|
+
Performance/RedundantSplitRegexpArgument:
|
225
|
+
Enabled: false
|
226
|
+
|
227
|
+
Style/OptionalBooleanParameter:
|
228
|
+
Enabled: false
|
229
|
+
|
230
|
+
Style/RedundantArgument:
|
231
|
+
Enabled: false
|
232
|
+
|
233
|
+
Style/MutableConstant:
|
234
|
+
Enabled: false
|
235
|
+
|
236
|
+
Naming/PredicateName:
|
237
|
+
Enabled: false
|
238
|
+
|
239
|
+
Lint/UnusedBlockArgument:
|
240
|
+
Enabled: false
|
241
|
+
|
242
|
+
Style/RaiseArgs:
|
243
|
+
Enabled: false
|
244
|
+
|
245
|
+
Style/MultilineBlockChain:
|
246
|
+
Enabled: false
|
247
|
+
|
248
|
+
Performance/Sum:
|
249
|
+
Enabled: false
|
250
|
+
|
251
|
+
Lint/UnexpectedBlockArity:
|
252
|
+
Enabled: false
|
253
|
+
|
254
|
+
Lint/SymbolConversion:
|
255
|
+
Enabled: false
|
256
|
+
|
257
|
+
Performance/CollectionLiteralInLoop:
|
258
|
+
Enabled: false
|
259
|
+
|
260
|
+
Style/FormatString:
|
261
|
+
Enabled: false
|
262
|
+
|
263
|
+
Style/FormatStringToken:
|
264
|
+
Enabled: false
|
265
|
+
|
266
|
+
Lint/MissingSuper:
|
267
|
+
Enabled: false
|
268
|
+
|
269
|
+
Style/NumericLiterals:
|
270
|
+
Enabled: false
|
271
|
+
|
272
|
+
Style/RegexpLiteral:
|
273
|
+
Enabled: false
|
274
|
+
|
275
|
+
Style/PreferredHashMethods:
|
276
|
+
Enabled: false
|
277
|
+
|
278
|
+
Lint/EmptyClass:
|
279
|
+
Enabled: false
|
280
|
+
|
281
|
+
Style/WhileUntilModifier:
|
282
|
+
Enabled: false
|
283
|
+
|
284
|
+
Lint/DisjunctiveAssignmentInConstructor:
|
285
|
+
Enabled: false
|
286
|
+
|
287
|
+
Style/FloatDivision:
|
288
|
+
Enabled: false
|
289
|
+
|
290
|
+
Lint/ToJSON:
|
291
|
+
Enabled: false
|
292
|
+
|
293
|
+
Performance/Casecmp:
|
294
|
+
Enabled: false
|
295
|
+
|
296
|
+
Style/CommentAnnotation:
|
297
|
+
Enabled: false
|
298
|
+
|
299
|
+
Lint/EmptyFile:
|
300
|
+
Enabled: false
|
301
|
+
|
302
|
+
Style/AccessorGrouping:
|
303
|
+
Enabled: false
|
304
|
+
|
305
|
+
Naming/MethodName:
|
306
|
+
Enabled: false
|
307
|
+
|
308
|
+
Style/DoubleNegation:
|
309
|
+
Enabled: false
|
310
|
+
|
311
|
+
Lint/AmbiguousBlockAssociation:
|
312
|
+
Enabled: false
|
313
|
+
|
314
|
+
Performance/TimesMap:
|
315
|
+
Enabled: false
|
316
|
+
|
317
|
+
Style/ExpandPathArguments:
|
318
|
+
Enabled: false
|
319
|
+
|
320
|
+
Style/Lambda:
|
321
|
+
Enabled: false
|
322
|
+
|
323
|
+
Style/RedundantSelfAssignment:
|
324
|
+
Enabled: false
|
325
|
+
|
326
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
327
|
+
Enabled: false
|
328
|
+
|
329
|
+
Style/NegatedIfElseCondition:
|
330
|
+
Enabled: false
|
3
331
|
|
4
|
-
|
5
|
-
|
6
|
-
EnforcedStyle: double_quotes
|
332
|
+
Lint/ImplicitStringConcatenation:
|
333
|
+
Enabled: false
|
7
334
|
|
8
|
-
|
9
|
-
|
10
|
-
EnforcedStyle: double_quotes
|
335
|
+
Rails/RenderInline:
|
336
|
+
Enabled: false
|
11
337
|
|
12
|
-
|
13
|
-
|
338
|
+
Rails/LexicallyScopedActionFilter:
|
339
|
+
Enabled: false
|
data/.rubocop_strict.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Inspiration: https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard
|
2
|
+
# There are a handful of cops that should be applied to all
|
3
|
+
# files always regardless of anything.
|
4
|
+
# These are those cops.
|
5
|
+
Lint/Debugger: # don't leave binding.pry
|
6
|
+
Enabled: true
|
7
|
+
Exclude: []
|
8
|
+
|
9
|
+
RSpec/Focus: # run ALL tests on CI
|
10
|
+
Enabled: true
|
11
|
+
Exclude: []
|
12
|
+
|
13
|
+
Rails/Output: # Don't leave puts-debugging
|
14
|
+
Enabled: true
|
15
|
+
Exclude: []
|
16
|
+
|
17
|
+
Rails/FindEach: # each could severely affect the performance, use find_each
|
18
|
+
Enabled: true
|
19
|
+
Exclude: []
|
20
|
+
|
21
|
+
Rails/UniqBeforePluck: # uniq.pluck and not pluck.uniq
|
22
|
+
Enabled: true
|
23
|
+
Exclude: []
|
data/README.md
CHANGED
@@ -1,35 +1,62 @@
|
|
1
1
|
# CloudwatchMetrics
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
`CloudwatchMetrics` is a Ruby gem for writing custom metrics to AWS Cloudwatch.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
7
|
Add this line to your application's Gemfile:
|
10
|
-
|
11
8
|
```ruby
|
12
9
|
gem 'cloudwatch_metrics'
|
13
10
|
```
|
14
11
|
|
15
12
|
And then execute:
|
13
|
+
```
|
14
|
+
bundle install
|
15
|
+
```
|
16
16
|
|
17
|
-
|
17
|
+
To create the initializer:
|
18
|
+
```
|
19
|
+
rails generate cloudwatch_metrics:initializer
|
20
|
+
```
|
18
21
|
|
19
|
-
|
22
|
+
The initializer contains descriptions for all available options. The only options you must provide a value for are listed below:
|
23
|
+
|
24
|
+
* **namespace**: This is the default namespace that all metrics will be published to. This should probably match the name of your application or service.
|
20
25
|
|
21
|
-
$ gem install cloudwatch_metrics
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
|
29
|
+
Available methods are in the `CloudwatchMetrics` module. For convenience this is aliased to `CW` by default.
|
30
|
+
|
31
|
+
Metrics are reported using `CW.report` for single data points, or `CW.report_all` for collections of data points. Required and optional parameters for these methods are detailed below.
|
32
|
+
|
33
|
+
### CW.report Required Parameters
|
34
|
+
|
35
|
+
* `metric_name`: The name of the metric.
|
36
|
+
* `value`: The value for the single data point being reported.
|
37
|
+
|
38
|
+
E.g. `CW.report(metric_name: 'search_result_count', value: 25)`
|
39
|
+
|
40
|
+
|
41
|
+
`CW.report_all` has a similar method signature, but takes an array of values, and a corresponding array indicating how many times each value occurred during the period.
|
42
|
+
|
43
|
+
### CW.report_all Required Parameters
|
44
|
+
|
45
|
+
* `metric_name`: The name of the metric.
|
46
|
+
* `values`: Array of values for the data points being reported.
|
47
|
+
* `counts`: Array of numbers indicating the number of times each value occurred during the period. The length of this array should match the length of the `values` array.
|
48
|
+
|
49
|
+
E.g. `CW.report_all(metric_name: 'search_result_count', values: [25, 50, 65], counts: [1, 2, 1])`
|
26
50
|
|
27
|
-
|
51
|
+
### Optional Parameters
|
28
52
|
|
29
|
-
|
53
|
+
Both reporting methods accept optional parameters, which are detailed below, along with their default values
|
30
54
|
|
31
|
-
|
55
|
+
* `unit`: The unit of measure for this data point. Units help provide conceptual meaning to your data, but CloudWatch attaches no significance to a unit internally. Common values are `Seconds`, `Kilobytes`, `Percent`, `Count`, `Kilobytes/Second`. Default value is `None`. A full list of available units is available at `CloudwatchMetrics.Units`.
|
56
|
+
* `namespace`: Override the namespace set in the initializer. Default is `nil`
|
57
|
+
* `dimensions`: An array of name/value pairs that form part of the identity of a metric. Dimensions allow you to group and filter data points within a particular metric. Default is `nil`.
|
58
|
+
* `timestamp`: The time associated with the data point. The timestamp can be up to two weeks in the past and up to two hours into the future. Default is the current time.
|
32
59
|
|
33
|
-
##
|
60
|
+
## Cloudwatch Concepts
|
34
61
|
|
35
|
-
|
62
|
+
Refer to the [Cloudwatch Documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html) for a general overview of custom metrics in CloudWatch.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CloudwatchMetrics
|
4
|
+
SECONDS = 'Seconds'
|
5
|
+
MICROSECONDS = 'Microseconds'
|
6
|
+
MILLISECONDS = 'Milliseconds'
|
7
|
+
BYTES = 'Bytes'
|
8
|
+
KILOBYTES = 'Kilobytes'
|
9
|
+
MEGABYTES = 'Megabytes'
|
10
|
+
GIGABYTES = 'Gigabytes'
|
11
|
+
TERABYTES = 'Terabytes'
|
12
|
+
BITS = 'Bits'
|
13
|
+
KILOBITS = 'Kilobits'
|
14
|
+
MEGABITS = 'Megabits'
|
15
|
+
GIGABITS = 'Gigabits'
|
16
|
+
TERABITS = 'Terabits'
|
17
|
+
PERCENT = 'Percent'
|
18
|
+
COUNT = 'Count'
|
19
|
+
BYTES_PER_SECOND = 'Bytes/Second'
|
20
|
+
KILOBYTES_PER_SECOND = 'Kilobytes/Second'
|
21
|
+
MEGABYTES_PER_SECOND = 'Megabytes/Second'
|
22
|
+
GIGABYTES_PER_SECOND = 'Gigabytes/Second'
|
23
|
+
TERABYTES_PER_SECOND = 'Terabytes/Second'
|
24
|
+
BITS_PER_SECOND = 'Bits/Second'
|
25
|
+
KILOBITS_PER_SECOND = 'Kilobits/Second'
|
26
|
+
MEGABITS_PER_SECOND = 'Megabits/Second'
|
27
|
+
GIGABITS_PER_SECOND = 'Gigabits/Second'
|
28
|
+
TERABITS_PER_SECOND = 'Terabits/Second'
|
29
|
+
COUNT_PER_SECOND = 'Count/Second'
|
30
|
+
NONE = 'None'
|
31
|
+
|
32
|
+
UNITS = [
|
33
|
+
SECONDS, MICROSECONDS, MILLISECONDS, BYTES, KILOBYTES, MEGABYTES, GIGABYTES, TERABYTES, BITS, KILOBITS,
|
34
|
+
MEGABITS, GIGABITS, TERABITS, PERCENT, COUNT, BYTES_PER_SECOND, KILOBYTES_PER_SECOND, MEGABYTES_PER_SECOND,
|
35
|
+
GIGABYTES_PER_SECOND, TERABYTES_PER_SECOND, BITS_PER_SECOND, KILOBITS_PER_SECOND, MEGABITS_PER_SECOND,
|
36
|
+
GIGABITS_PER_SECOND, TERABITS_PER_SECOND, COUNT_PER_SECOND, NONE
|
37
|
+
]
|
38
|
+
|
39
|
+
end
|
data/lib/cloudwatch_metrics.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'cloudwatch_metrics/configuration'
|
4
4
|
|
5
|
+
# Posts custom metrics to AWS CloudWatch
|
5
6
|
module CloudwatchMetrics
|
6
7
|
class Error < StandardError; end
|
7
8
|
|
@@ -17,5 +18,43 @@ module CloudwatchMetrics
|
|
17
18
|
def hi
|
18
19
|
puts "Hello, #{configuration.namespace}"
|
19
20
|
end
|
21
|
+
|
22
|
+
def record(
|
23
|
+
metric_name:, value:, unit: nil, namespace: configuration.namespace, dimensions: [], timestamp: nil
|
24
|
+
)
|
25
|
+
metric_data = [{
|
26
|
+
metric_name: metric_name,
|
27
|
+
value: value,
|
28
|
+
unit: unit,
|
29
|
+
dimensions: dimensions,
|
30
|
+
timestamp: timestamp
|
31
|
+
}]
|
32
|
+
put_data(namespace: namespace, metric_data: metric_data)
|
33
|
+
end
|
34
|
+
|
35
|
+
def record_all(
|
36
|
+
metric_name:, values:, counts:, unit: nil, namespace: configuration.namespace, dimensions: [], timestamp: nil
|
37
|
+
)
|
38
|
+
metric_data = [{
|
39
|
+
metric_name: metric_name,
|
40
|
+
values: values,
|
41
|
+
counts: counts,
|
42
|
+
unit: unit,
|
43
|
+
dimensions: dimensions,
|
44
|
+
timestamp: timestamp
|
45
|
+
}]
|
46
|
+
put_data(namespace: namespace, metric_data: metric_data)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def put_data(namespace:, metric_data:)
|
52
|
+
resp = @cloudwatch_client.put_metric_data({
|
53
|
+
namespace: namespace,
|
54
|
+
metric_data: metric_data
|
55
|
+
})
|
56
|
+
end
|
20
57
|
end
|
21
58
|
end
|
59
|
+
|
60
|
+
CW = CloudwatchMetrics unless configuration.no_cw_alias
|
@@ -3,7 +3,12 @@
|
|
3
3
|
require 'cloudwatch_metrics'
|
4
4
|
|
5
5
|
CloudwatchMetrics.configure do |config|
|
6
|
-
# This is the default namespace that all metrics
|
7
|
-
#
|
8
|
-
config.namespace =
|
6
|
+
# This is the default namespace that all metrics will be published to.
|
7
|
+
# This should probably match the name of your application or service.
|
8
|
+
config.namespace = 'APPLICATION_NAME'
|
9
|
+
|
10
|
+
# This is an optional configuration that will allow you to disable the
|
11
|
+
# `CW` alias. This is useful if you have a constant named `CW` that
|
12
|
+
# conflicts with the alias. Default is `false`.
|
13
|
+
# config.no_cw_alias = true
|
9
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudwatch-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Puckett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-cloudwatch
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".rspec"
|
77
77
|
- ".rubocop.yml"
|
78
|
+
- ".rubocop_strict.yml"
|
78
79
|
- Gemfile
|
79
80
|
- Gemfile.lock
|
80
81
|
- README.md
|
@@ -83,6 +84,7 @@ files:
|
|
83
84
|
- bin/setup
|
84
85
|
- lib/cloudwatch_metrics.rb
|
85
86
|
- lib/cloudwatch_metrics/configuration.rb
|
87
|
+
- lib/cloudwatch_metrics/constants.rb
|
86
88
|
- lib/cloudwatch_metrics/version.rb
|
87
89
|
- lib/generators/cloudwatch_metrics/initializer_generator.rb
|
88
90
|
- lib/generators/cloudwatch_metrics/templates/cloudwatch_metrics.rb
|