Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: repeat-interval #852

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check if last reminder is zero, set last reminder on resolved
sabey committed Aug 31, 2024
commit a789c006da3ef2d13514ccbc0ef7e10c44f39521
4 changes: 3 additions & 1 deletion watchdog/alerting.go
Original file line number Diff line number Diff line change
@@ -34,7 +34,8 @@ func handleAlertsToTrigger(ep *endpoint.Endpoint, result *endpoint.Result, alert
// Determine if an initial alert should be sent
sendInitialAlert := !endpointAlert.Triggered
// Determine if a reminder should be sent
sendReminder := endpointAlert.Triggered && endpointAlert.RepeatInterval > 0 && time.Since(ep.LastReminderSent) >= endpointAlert.RepeatInterval
sendReminder := endpointAlert.Triggered && endpointAlert.RepeatInterval > 0 &&
(ep.LastReminderSent.IsZero() || time.Since(ep.LastReminderSent) >= endpointAlert.RepeatInterval)
// If neither initial alert nor reminder needs to be sent, skip to the next alert
if !sendInitialAlert && !sendReminder {
if debug {
@@ -109,4 +110,5 @@ func handleAlertsToResolve(ep *endpoint.Endpoint, result *endpoint.Result, alert
}
}
ep.NumberOfFailuresInARow = 0
ep.LastReminderSent = time.Now()
}