mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-26 01:43:41 +01:00
better debugging
This commit is contained in:
parent
a789c006da
commit
f83ce9993f
@ -34,12 +34,16 @@ 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 &&
|
||||
(ep.LastReminderSent.IsZero() || time.Since(ep.LastReminderSent) >= endpointAlert.RepeatInterval)
|
||||
var lastReminder time.Duration
|
||||
if !ep.LastReminderSent.IsZero() {
|
||||
lastReminder = time.Since(ep.LastReminderSent)
|
||||
}
|
||||
sendReminder := endpointAlert.Triggered && endpointAlert.RepeatInterval > 0 && lastReminder >= endpointAlert.RepeatInterval
|
||||
// If neither initial alert nor reminder needs to be sent, skip to the next alert
|
||||
if !sendInitialAlert && !sendReminder {
|
||||
if debug {
|
||||
log.Printf("[watchdog.handleAlertsToTrigger] Alert for endpoint=%s with description='%s' is not due for triggering or reminding, skipping", ep.Name, endpointAlert.GetDescription())
|
||||
log.Printf("[watchdog.handleAlertsToTrigger] Alert for endpoint=%s with description='%s' is not due for triggering or reminding (interval: %s last: %s), skipping",
|
||||
ep.Name, endpointAlert.GetDescription(), endpointAlert.RepeatInterval, lastReminder)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user