Skip to content

Commit

Permalink
Merge branch 'main' into lock_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Jul 24, 2024
2 parents 8267c5f + 7998eeb commit f01efe4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,26 @@ export enum HttpCodeElb {
* The number of HTTP 5XX server error codes that originate from the load balancer.
*/
ELB_5XX_COUNT = 'HTTPCode_ELB_5XX_Count',

/**
* The number of HTTP 500 server error codes that originate from the load balancer.
*/
ELB_500_COUNT = 'HTTPCode_ELB_500_Count',

/**
* The number of HTTP 502 server error codes that originate from the load balancer.
*/
ELB_502_COUNT = 'HTTPCode_ELB_502_Count',

/**
* The number of HTTP 503 server error codes that originate from the load balancer.
*/
ELB_503_COUNT = 'HTTPCode_ELB_503_Count',

/**
* The number of HTTP 504 server error codes that originate from the load balancer.
*/
ELB_504_COUNT = 'HTTPCode_ELB_504_Count',
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,29 @@ describe('tests', () => {
}
});

test.each([
elbv2.HttpCodeElb.ELB_500_COUNT,
elbv2.HttpCodeElb.ELB_502_COUNT,
elbv2.HttpCodeElb.ELB_503_COUNT,
elbv2.HttpCodeElb.ELB_504_COUNT,
])('use specific load balancer generated 5XX metrics', (metricName) => {
// GIVEN
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'Stack');
const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc });

// WHEN
const metric = lb.metrics.httpCodeElb(metricName);

// THEN
expect(metric.namespace).toEqual('AWS/ApplicationELB');
expect(metric.statistic).toEqual('Sum');
expect(metric.metricName).toEqual(metricName);
expect(stack.resolve(metric.dimensions)).toEqual({
LoadBalancer: { 'Fn::GetAtt': ['LB8A12904C', 'LoadBalancerFullName'] },
});
});

test('loadBalancerName', () => {
// GIVEN
const stack = new cdk.Stack();
Expand Down

0 comments on commit f01efe4

Please sign in to comment.