Skip to content

Commit ce5cd07

Browse files
committed
Fix alarm thresholds
1 parent 3a16cc2 commit ce5cd07

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

cdk/lib/__snapshots__/liveactivities.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
476476
"Value": "CODE",
477477
},
478478
],
479-
"Threshold": 10,
479+
"Threshold": 1,
480480
"TreatMissingData": "notBreaching",
481481
},
482482
"Type": "AWS::CloudWatch::Alarm",
@@ -568,7 +568,7 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
568568
"Value": "CODE",
569569
},
570570
],
571-
"Threshold": 10,
571+
"Threshold": 1,
572572
"TreatMissingData": "notBreaching",
573573
},
574574
"Type": "AWS::CloudWatch::Alarm",
@@ -660,7 +660,7 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
660660
"Value": "CODE",
661661
},
662662
],
663-
"Threshold": 10,
663+
"Threshold": 1,
664664
"TreatMissingData": "notBreaching",
665665
},
666666
"Type": "AWS::CloudWatch::Alarm",

cdk/lib/liveactivities.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ const addApnsErrorAlarm = (
4343
app: string,
4444
stage: string,
4545
metricLambdaName: string,
46+
threshold: number = 1,
4647
) => {
4748
const namespace = `Notifications/${stage}/liveactivities-${metricLambdaName}`;
49+
// APNS traffic is low-volume and bursty.
4850
const period = Duration.minutes(5);
4951
const apns4xx = new Metric({
5052
namespace,
@@ -70,7 +72,7 @@ const addApnsErrorAlarm = (
7072
label: 'APNS 4xx + 5xx',
7173
period,
7274
}),
73-
threshold: 10,
75+
threshold,
7476
evaluationPeriods: 1,
7577
comparisonOperator: ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
7678
treatMissingData: TreatMissingData.NOT_BREACHING,
@@ -301,9 +303,11 @@ export class LiveActivities extends GuStack {
301303
);
302304

303305
//////////// Alarm on APNS 4xx/5xx responses /////////////
304-
addApnsErrorAlarm(this, app, stage, 'broadcast');
305-
addApnsErrorAlarm(this, app, stage, 'channel-manager');
306-
addApnsErrorAlarm(this, app, stage, 'channel-cleaner');
306+
// Fire on any APNS 4xx/5xx error for each low-volume lambda. The alarm self-resolves back to OK
307+
// once errors stop (missing data is treated as not breaching).
308+
addApnsErrorAlarm(this, app, stage, 'broadcast', 1);
309+
addApnsErrorAlarm(this, app, stage, 'channel-manager', 1);
310+
addApnsErrorAlarm(this, app, stage, 'channel-cleaner', 1);
307311

308312
//////////// EVENTBUS INFRASTRUCTURE //////////////
309313

0 commit comments

Comments
 (0)