From 596d30389f0a8dae82116a57bd814211be8042c5 Mon Sep 17 00:00:00 2001 From: Chris Buckley Date: Wed, 17 Nov 2021 11:17:12 +0000 Subject: [PATCH] Increment failed checks at least once Currently, a failure is only recorded if a monitor transitions from operational to not in a given day. If the monitor is non-operational at the start of the day, or remains non-operational for a full day, the failure will not be recorded. --- src/functions/cronTrigger.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/functions/cronTrigger.js b/src/functions/cronTrigger.js index f18a2601a..671f1a310 100644 --- a/src/functions/cronTrigger.js +++ b/src/functions/cronTrigger.js @@ -141,8 +141,8 @@ export async function processCronTrigger(event) { // Save allOperational to false monitorsState.lastUpdate.allOperational = false - // Increment failed checks, only on status change (maybe call it .incidents instead?) - if (monitorStatusChanged) { + // Increment failed checks on status change or first fail of the day (maybe call it .incidents instead?) + if (monitorStatusChanged || monitorsState.monitors[monitor.id].checks[checkDay].fails == 0) { monitorsState.monitors[monitor.id].checks[checkDay].fails++ } }