-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(cloudwatch): EC2 actions #13281
Conversation
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
Pull request has been modified.
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.
Almost there, thanks for the work!
this.alarmActionArns.push(...actions.map(a => { | ||
const actionArn = a.bind(this, this).alarmActionArn; | ||
|
||
const ec2ActionsRegexp: RegExp = /arn:aws:automate:[a-z|\d|-]+:ec2:[a-z]+/; |
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 don't mind this functionality living here, but could you factor it out into a separate (private) function?
// Check per-instance metric | ||
const metricConfig = this.metric.toMetricConfig(); | ||
if (metricConfig.metricStat?.dimensions?.length != 1 || metricConfig.metricStat?.dimensions![0].name != 'InstanceId') { | ||
throw new Error('EC2 alarm actions must use an EC2 Per-Instance Metric'); |
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.
The error message should show the incorrect configuration.
How about:
`EC2 alarm actions requires an EC2 Per-Instance Metric (${JSON.stringify(metricConfig)} does not have an 'InstanceId' dimension)`
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Fixes aws#13228 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes #13228
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license