Skip to content
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-actions): support alarm lambda action #28484

Merged
merged 32 commits into from
Jan 11, 2024

Conversation

neilkuan
Copy link
Contributor

feat(cloudwatch-action): support alarm lambda action

Closes #28483


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added feature-request A feature should be added or improved. p2 labels Dec 24, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team December 24, 2023 11:48
@github-actions github-actions bot added the admired-contributor [Pilot] contributed between 13-24 PRs to the CDK label Dec 24, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review January 1, 2024 05:23

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@neilkuan
Copy link
Contributor Author

neilkuan commented Jan 1, 2024

Waiting #28542 merged.

@neilkuan neilkuan force-pushed the support-cloudwatch-alarm-lambda-action branch from 0fefaed to d2e6e06 Compare January 1, 2024 05:37
@neilkuan neilkuan changed the title feat(cloudwatch-action): support alarm lambda action feat(cloudwatch-actions): support alarm lambda action Jan 2, 2024
@github-actions github-actions bot added the effort/medium Medium work item – several days of effort label Jan 2, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 3, 2024
@neilkuan
Copy link
Contributor Author

neilkuan commented Jan 3, 2024

hi @go-to-k cloud you help review this PR ?!
Thanks~~~

Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neilkuan
Yes, I made some minor comments.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 3, 2024
@neilkuan neilkuan requested a review from go-to-k January 4, 2024 03:57
@neilkuan neilkuan requested a review from go-to-k January 4, 2024 06:36
Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good👍

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 4, 2024
Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good to me, could you just add a description to the example in the README please?

@mergify mergify bot dismissed paulhcsun’s stale review January 11, 2024 00:45

Pull request has been modified.

Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @neilkuan, thanks for this contribution!

And thank you for reviewing @go-to-k!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 7aec9fe
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Jan 11, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit b9f4923 into aws:main Jan 11, 2024
11 checks passed
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricAlarm.html
*/
bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig {
this.lambdaFunction.addPermission('AlarmPermission', {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the id not generated? Using static value AlarmPermission prohibits using the same lambda for multiple actions.

Something like this

const lambdaAction = () => new awsCloudWatchActions.LambdaAction(lambda);
alarmConcurrentLambdasMaximumReached.addAlarmAction(lambdaAction());
alarmRdsCpuUtilizationMaximumReached.addAlarmAction(lambdaAction());

leads to following error:

      throw new Error(`There is already a Construct with name '${childName}' in ${typeName}${name.length > 0 ? ' [' + name + ']' : ''}`);
            ^
Error: There is already a Construct with name 'AlarmPermission' in NodejsFunction [...]

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

@go-to-k go-to-k Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I have submitted a PR, so please wait a little longer.

#28712

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for your very fast support!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! If you could upvote in the PR, the review may be prioritized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cloudwatch-action: support alarm action lambda
8 participants