aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.33k stars 3.76k forks source link

chore(elasticloadbalancingv2): specific 5XX CloudWatch metrics for ALB #30659

Open sakurai-ryo opened 3 days ago

sakurai-ryo commented 3 days ago

Reason for this change

ALB supports metrics for specific load balancer generated 5XX level error metrics. https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html

However, they are currently not included in HttpCodeElb, so the metrics.httpCodeElb method is not available and metrics.custom must be used.

let alb: IApplicationLoadBalancer;
alb.metrics.httpCodeElb(HttpCodeElb.ELB_5XX_COUNT); // we can do this
alb.metrics.httpCodeElb(HttpCodeElb.ELB_500_COUNT); // currently we cannot do this
alb.metrics.custom("HTTPCode_ELB_500_Count");

Adding the metric names to HttpCodeElb makes it easier to understand as it can be configured in the same way as HTTPCode_ELB_5XX_Count.

Description of changes

Add metrics names to HttpCodeElb.

Description of how you validated changes

Checklist


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

aws-cdk-automation commented 3 days ago

AWS CodeBuild CI Report

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