Skip to content

Commit

Permalink
feat: adjusting configuration for the target response times of servic…
Browse files Browse the repository at this point in the history
…es (#655)
  • Loading branch information
nutrina authored Aug 7, 2024
1 parent f82ca34 commit 9dbb9aa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
27 changes: 26 additions & 1 deletion infra/aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,41 @@ const alarmConfigurations: AlarmConfigurations = {
percentHTTPCodeTarget4XX: 0.5, // 0..1 value for target error codes
percentHTTPCodeTarget5XX: 0.01, // 0..1 value for target error codes
targetResponseTime: 2, // seconds
period: 60,
datapointsToAlarm: 3,
evaluationPeriods: 5,
},
"passport-analysis-GET-0": {
percentHTTPCodeTarget4XX: 0.5, // 0..1 value for target error codes
percentHTTPCodeTarget5XX: 0.01, // 0..1 value for target error codes
targetResponseTime: 20, // 20 seconds - this is a slower request
period: 60,
datapointsToAlarm: 3,
evaluationPeriods: 5,
},
"cc-v1-score-POST-0": {
percentHTTPCodeTarget4XX: 0.5, // 0..1 value for target error codes
percentHTTPCodeTarget5XX: 0.01, // 0..1 value for target error codes
targetResponseTime: 5, // 5 seconds - this is a slower request
targetResponseTime: 2,
period: 60,
datapointsToAlarm: 3,
evaluationPeriods: 5,
},
"cc-v1-st-bulk-PATCH-0": {
percentHTTPCodeTarget4XX: 0.5, // 0..1 value for target error codes
percentHTTPCodeTarget5XX: 0.01, // 0..1 value for target error codes
targetResponseTime: 2,
period: 60,
datapointsToAlarm: 10,
evaluationPeriods: 15,
},
"submit-passport-0": {
percentHTTPCodeTarget4XX: 0.5, // 0..1 value for target error codes
percentHTTPCodeTarget5XX: 0.01, // 0..1 value for target error codes
targetResponseTime: 2,
period: 60,
datapointsToAlarm: 10,
evaluationPeriods: 15,
},
};

Expand Down
5 changes: 5 additions & 0 deletions infra/lib/scorer/loadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Topic } from "@pulumi/aws/sns";

export type TargetGroupAlarmsConfiguration = {
targetResponseTime: number;
datapointsToAlarm: number;
evaluationPeriods: number;
period: number;
percentHTTPCodeTarget4XX: number; // 0..1 value for target error codes
percentHTTPCodeTarget5XX: number; // 0..1 value for target error codes
};
Expand All @@ -18,6 +21,8 @@ export type AlarmConfigurations = {
default: TargetGroupAlarmsConfiguration;
"passport-analysis-GET-0": TargetGroupAlarmsConfiguration;
"cc-v1-score-POST-0": TargetGroupAlarmsConfiguration;
"cc-v1-st-bulk-PATCH-0": TargetGroupAlarmsConfiguration;
"submit-passport-0": TargetGroupAlarmsConfiguration;
};

export function createLoadBalancerAlarms(
Expand Down
6 changes: 3 additions & 3 deletions infra/lib/scorer/new_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,16 +1071,16 @@ export function buildHttpLambdaFn(
alarmActions: [alertTopic.arn],
okActions: [alertTopic.arn],
comparisonOperator: "GreaterThanThreshold",
datapointsToAlarm: 3,
datapointsToAlarm: alarmConfig.datapointsToAlarm,
dimensions: {
LoadBalancer: alb.arnSuffix,
TargetGroup: lambdaTargetGroup.arnSuffix,
},
evaluationPeriods: 5,
evaluationPeriods: alarmConfig.evaluationPeriods,
metricName: "TargetResponseTime",
name: `TargetResponseTime-${name}`,
namespace: metricNamespace,
period: 60,
period: alarmConfig.period,
statistic: "Average",
treatMissingData: "notBreaching",
threshold: alarmConfig.targetResponseTime,
Expand Down

0 comments on commit 9dbb9aa

Please sign in to comment.