Say a restart count is automatic restarts since the last start or creation
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate pass: builds mesh-controller → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed

NRestarts and RestartCount reset on a start by hand or a recreation, so
"whole life" was as wrong as "since" (novox/hq issue 458).
This commit is contained in:
2026-10-12 10:45:40 +02:00
parent 0d08d5c730
commit 63079e2c67
2 changed files with 11 additions and 10 deletions
+7 -6
View File
@@ -497,7 +497,7 @@ func moduleUnhealthyObservation(module, node string, rs []inventory.ResourceHeal
continue
}
words = append(words, fmt.Sprintf("its %s %s %s", r.Kind, r.Resource, reasonWords(r)))
// The restart count is the unit's or container's whole life, never the time since (novox/hq issue 458).
// The restart count runs from the last start or creation, not from the state's since (novox/hq issue 458).
said = append(said, fmt.Sprintf("%s (%s %s): %s, since %s, %d look(s) in a row, %s",
r.Resource, r.Kind, r.Target, orNotSaid(r.Reason), r.Since.UTC().Format("2006-01-02 15:04:05 MST"),
r.Streak, restartsWords(r.Restarts)))
@@ -514,11 +514,12 @@ func moduleUnhealthyObservation(module, node string, rs []inventory.ResourceHeal
Resolved: fmt.Sprintf("%s works again on %s", module, node)}
}
// restartsWords is a restart count as what it is: the engine reads it from systemd's NRestarts or the
// runtime's restart count, which run over the unit's or container's whole life, so it is never said beside a
// "since" as if it counted from there (novox/hq issue 458).
// restartsWords is a restart count as what it is (novox/hq issue 458): the engine reads systemd's NRestarts,
// which counts only restarts its Restart= setting caused and resets when the unit is started by hand, or the
// runtime's RestartCount, which counts only restart-policy restarts and is lost when the container is
// recreated. So it counts automatic restarts since the last start or creation, never since a state's "since".
func restartsWords(n int) string {
return fmt.Sprintf("%d restart(s) over its whole life", n)
return fmt.Sprintf("%d automatic restart(s) since it was last started or created", n)
}
// reasonWords is why a resource is unhealthy, as a person reads it.
@@ -733,7 +734,7 @@ func healthLines(h inventory.NodeHealth, had bool, now time.Time) []string {
line += " — " + r.Reason
}
if r.Restarts > 0 {
line += ", " + restartsWords(r.Restarts) + ", not since then"
line += ", " + restartsWords(r.Restarts)
}
if r.State == link.StateUnhealthy && h.Streaks[r.Module] < moduleUnhealthyAfter {
line += " (unconfirmed: said once)"