Skip to content

Commit c105661

Browse files
fix(package-sources): adjust canary alarm timing to match hourly execution (#1813)
Adjusts the NPM.js canary alarm timing configuration to properly trigger when the SLA is breached. ## Problem The previous configuration would never trigger the alarm. With a 5 minute period and 4 evaluation periods, the alarm would evaluate over a 20 minute window. However, the canary runs once per hour, meaning CloudWatch only receives metrics hourly. Since we treat missing data points as not breaching, there would never be enough data points to evaluate 4 periods before the next canary run, preventing the alarm from ever triggering. ## Solution The new configuration uses a 10 minute period with 1 evaluation period. This triggers the alarm immediately when a canary run reports metrics exceeding the SLA threshold. Since exceeding the SLA is itself a breach, there's no need to wait for multiple data points. The 10 minute period provides quick detection while accounting for potential drift in the hourly canary schedule. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 363b53a commit c105661

File tree

3 files changed

+38
-39
lines changed

3 files changed

+38
-39
lines changed

src/__tests__/__snapshots__/construct-hub.test.ts.snap

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__tests__/devapp/__snapshots__/snapshot.test.ts.snap

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package-sources/npmjs.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,7 @@ export class NpmJs implements IPackageSource {
606606
packageName,
607607
});
608608

609-
const period = Duration.minutes(5);
610-
609+
const period = Duration.minutes(10); // we run canary once per hour, but not guaranteed exact times
611610
const alarm = new MathExpression({
612611
expression: 'MAX([mDwell, mTTC])',
613612
period,
@@ -622,7 +621,7 @@ export class NpmJs implements IPackageSource {
622621
`Runbook: ${RUNBOOK_URL}`,
623622
].join('\n'),
624623
comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
625-
evaluationPeriods: 4,
624+
evaluationPeriods: 1,
626625
treatMissingData: TreatMissingData.NOT_BREACHING,
627626
threshold: visibilitySla.toSeconds(),
628627
});

0 commit comments

Comments
 (0)