R-1352: the does-not-answer alarm is not mailed after the restart mail of the same episode. Hub commit only.
gates / gates (push) Successful in 1m56s
gates / gates (push) Successful in 1m56s
This commit is contained in:
1 parent
a560e69954
commit
2f7e836f68
3 files changed
+74
-1
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-hub/internal/store"
|
||||
)
|
||||
@@ -140,11 +141,24 @@ func (c *ControllerSupervisorChecker) observe(hostID, customerID string, guests
|
||||
c.emit(customerID, hostID, g, "controller_slow_crashloop")
|
||||
}
|
||||
if g.UnresponsiveSince != "" && g.UnresponsiveSince != prev.unresponsiveSince {
|
||||
c.emit(customerID, hostID, g, "controller_unresponsive")
|
||||
// R-1352: the alarm and the restart of ONE episode lie 2 minutes apart and reports 15, so both can arrive together.
|
||||
// The restart's mail says all of it (since when, restarted when); an alarm after it („restarts it in 2 minutes")
|
||||
// reads backwards. A new episode after that restart has had no restart yet, and alarms.
|
||||
if !(unrespRestart && episodeRestarted(g.UnresponsiveSince, g.UnresponsiveRestartAt)) {
|
||||
c.emit(customerID, hostID, g, "controller_unresponsive")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// episodeRestarted reports whether the unresponsive episode that began at since is the one restarted at restartAt. A time
|
||||
// that cannot be read counts as „no": the alarm is mailed, the safe direction.
|
||||
func episodeRestarted(since, restartAt string) bool {
|
||||
s, err1 := time.Parse(time.RFC3339, since)
|
||||
r, err2 := time.Parse(time.RFC3339, restartAt)
|
||||
return err1 == nil && err2 == nil && !s.After(r)
|
||||
}
|
||||
|
||||
func (c *ControllerSupervisorChecker) emit(customerID, hostID string, g ControllerSupervisorGuest, eventType string) {
|
||||
var severity, message string
|
||||
switch eventType {
|
||||
|
||||
Reference in new issue
Block a user