Skip to content

Commit

Permalink
fix(infra): fix proper dimension value for 5xx, 4xx and response time… (
Browse files Browse the repository at this point in the history
#589)

* fix(infra): fix proper dimension value for 5xx, 4xx and response time alarms

* fix(infra): fix more alarm dimensions and namespaces

* fix(infra): fix namespace in alarm for running count in ECS tasks

* fix(infra): fix namespace in alarm for running count in ECS tasks

* fix(infra): fix namespace in alarm for memory utilisation

* fix(infra): fix evaluation for running task count
  • Loading branch information
nutrina authored May 10, 2024
1 parent 48f803e commit 979aeb9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion infra/aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ const lambdaSettings = {

createLoadBalancerAlarms(
"scorer-service",
alb.name,
alb.arnSuffix,
alarmConfigurations,
pagerdutyTopic
);
Expand Down
10 changes: 5 additions & 5 deletions infra/lib/scorer/loadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type AlarmConfigurations = {

export function createLoadBalancerAlarms(
name: string,
albName: Input<string>,
albArnSuffix: Input<string>,
loadBalancerAlarmThresholds: AlarmConfigurations,
alertTopic?: Topic
) {
Expand All @@ -40,7 +40,7 @@ export function createLoadBalancerAlarms(
metric: {
metricName: "RequestCount",
dimensions: {
LoadBalancer: albName,
LoadBalancer: albArnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand All @@ -52,7 +52,7 @@ export function createLoadBalancerAlarms(
metric: {
metricName: "HTTPCode_ELB_5XX_Count",
dimensions: {
LoadBalancer: albName,
LoadBalancer: albArnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand Down Expand Up @@ -89,7 +89,7 @@ export function createLoadBalancerAlarms(
metric: {
metricName: "RequestCount",
dimensions: {
LoadBalancer: albName,
LoadBalancer: albArnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand All @@ -101,7 +101,7 @@ export function createLoadBalancerAlarms(
metric: {
metricName: "HTTPCode_ELB_4XX_Count",
dimensions: {
LoadBalancer: albName,
LoadBalancer: albArnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand Down
46 changes: 23 additions & 23 deletions infra/lib/scorer/new_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ export function createScorerECSService(
evaluationPeriods: 1,
metricName: "RunningTaskCount",
name: `RunningTaskCount-${name}`,
namespace: "AWS/ECS",
namespace: "ECS/ContainerInsights",
period: 300,
statistic: "Sum",
statistic: "Average",
threshold: getAutoScaleMaxCapacity() * 0.75,
}
);
Expand All @@ -412,7 +412,7 @@ export function createScorerECSService(
evaluationPeriods: 1,
metricName: "MemoryUtilization",
name: `MemoryUtilization-${name}`,
namespace: "AWS/ECS",
namespace: "ECS",
period: 900,
statistic: "Average",
threshold: 80,
Expand Down Expand Up @@ -446,8 +446,8 @@ export function createScorerECSService(
metric: {
metricName: "RequestCountPerTarget",
dimensions: {
LoadBalancer: config.alb.name,
TargetGroup: config.targetGroup.name,
LoadBalancer: config.alb.arnSuffix,
TargetGroup: config.targetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand All @@ -459,8 +459,8 @@ export function createScorerECSService(
metric: {
metricName: "HTTPCode_Target_5XX_Count",
dimensions: {
LoadBalancer: config.alb.name,
TargetGroup: config.targetGroup.name,
LoadBalancer: config.alb.arnSuffix,
TargetGroup: config.targetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand Down Expand Up @@ -497,8 +497,8 @@ export function createScorerECSService(
metric: {
metricName: "RequestCountPerTarget",
dimensions: {
LoadBalancer: config.alb.name,
TargetGroup: config.targetGroup.name,
LoadBalancer: config.alb.arnSuffix,
TargetGroup: config.targetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand All @@ -510,8 +510,8 @@ export function createScorerECSService(
metric: {
metricName: "HTTPCode_Target_4XX_Count",
dimensions: {
LoadBalancer: config.alb.name,
TargetGroup: config.targetGroup.name,
LoadBalancer: config.alb.arnSuffix,
TargetGroup: config.targetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand Down Expand Up @@ -539,8 +539,8 @@ export function createScorerECSService(
comparisonOperator: "GreaterThanThreshold",
datapointsToAlarm: 3,
dimensions: {
LoadBalancer: config.alb.name,
TargetGroup: config.targetGroup.name,
LoadBalancer: config.alb.arnSuffix,
TargetGroup: config.targetGroup.arnSuffix,
},
evaluationPeriods: 5,
metricName: "TargetResponseTime",
Expand Down Expand Up @@ -1208,8 +1208,8 @@ export function buildHttpLambdaFn(
metric: {
metricName: "RequestCountPerTarget",
dimensions: {
LoadBalancer: alb.name,
TargetGroup: lambdaTargetGroup.name,
LoadBalancer: alb.arnSuffix,
TargetGroup: lambdaTargetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand All @@ -1221,8 +1221,8 @@ export function buildHttpLambdaFn(
metric: {
metricName: "HTTPCode_Target_5XX_Count",
dimensions: {
LoadBalancer: alb.name,
TargetGroup: lambdaTargetGroup.name,
LoadBalancer: alb.arnSuffix,
TargetGroup: lambdaTargetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand Down Expand Up @@ -1259,8 +1259,8 @@ export function buildHttpLambdaFn(
metric: {
metricName: "RequestCountPerTarget",
dimensions: {
LoadBalancer: alb.name,
TargetGroup: lambdaTargetGroup.name,
LoadBalancer: alb.arnSuffix,
TargetGroup: lambdaTargetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand All @@ -1272,8 +1272,8 @@ export function buildHttpLambdaFn(
metric: {
metricName: "HTTPCode_Target_4XX_Count",
dimensions: {
LoadBalancer: alb.name,
TargetGroup: lambdaTargetGroup.name,
LoadBalancer: alb.arnSuffix,
TargetGroup: lambdaTargetGroup.arnSuffix,
},
namespace: metricNamespace,
period: 60,
Expand Down Expand Up @@ -1301,8 +1301,8 @@ export function buildHttpLambdaFn(
comparisonOperator: "GreaterThanThreshold",
datapointsToAlarm: 3,
dimensions: {
LoadBalancer: alb.name,
TargetGroup: lambdaTargetGroup.name,
LoadBalancer: alb.arnSuffix,
TargetGroup: lambdaTargetGroup.arnSuffix,
},
evaluationPeriods: 5,
metricName: "TargetResponseTime",
Expand Down

0 comments on commit 979aeb9

Please sign in to comment.