Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(iot): add Action to capture CloudWatch metrics #17503
feat(iot): add Action to capture CloudWatch metrics #17503
Changes from 2 commits
c67d50f
b22ebec
98b8769
6ace2c8
12773ba
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use the
Metric
class from the CloudWatch module instead of all these separate props here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skinny85
I thought it too. But if using
Metric
class, we will not be able to use substitution templates.So I think it is better that we provide
fromMetric()
method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting... what's the problem that prevents using
Metric
with substitution templates?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skinny85
I had envisioned using
Metric
class as following.In above case, I predicted that users might think "I cannot use substitution templates in
namespace
,metricName
andunit
".Hmmm🤔. As I was writing this, I realized that there was nothing preventing from using substitution templates in properties besides
unit
as following.I'm a little uncomfortable with it, in that substitution templates are written in
Metric
class props. How about?And
unit
cannot be used with substitution templates becauseunit
is enum inMetric
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How common it is to use a dynamic Unit, do you think?
We can work around it by having something like:
It is a little bit awkward, I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a pretty rare case that a
unit
is used dynamically.For just one thing, How about this?
We keep current props, and we provide
metric()
method likemetric-filter.ts
.Because, in many case,
CloudWatchPutMetricAction
will generate new custom metric for example temperature, weight and moisture. And alerms will be created with this metrics.So I think users maybe will want metric after they make the topic rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the
Metric.grantPutMetricData()
method instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!