Skip to content

Commit 0c6d4fd

Browse files
authored
fix: MINIMUM_VIEWS not applied during Big Spike detection (#90)
1 parent 3bf342b commit 0c6d4fd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

application/src/backend/cron-anomaly-detection/stat_functions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ function evaluationWindowState(evaluations: Evaluation[], evaluateWindows: numbe
195195
const evaluationWindowBreached = evaluationWindow.reduce((a, b) => a && b.breached, true);
196196

197197
const latestEvaluation = evaluationWindow[evaluationWindow.length - 1];
198-
if (!evaluationWindowBreached && latestEvaluation.value > latestEvaluation.breachingThreshold * 2) {
198+
if (
199+
!evaluationWindowBreached &&
200+
latestEvaluation.value > latestEvaluation.breachingThreshold * 2 &&
201+
latestEvaluation.value > LambdaEnvironment.MINIMUM_VIEWS
202+
) {
199203
console.log('Big spike detected, evaluations in evaluation window is irrelevant', latestEvaluation.date);
200204
return {
201205
alarm: true,

0 commit comments

Comments
 (0)