log monitor push start + slow heartbeat
First successful push emits an info-level "monitor push started" so
operators can confirm the loop wired up correctly. Subsequent
successes log every 60 cycles ("monitor push heartbeat") so the
journal stays quiet but still proves the loop isn't dead. Errors
already log at warn; this fills the success-side gap so a silent
journal can't hide a "no successes, no errors" pathology.
This commit is contained in:
@@ -166,11 +166,26 @@ func (p *Pusher) Stats() PushStats {
|
||||
|
||||
func (p *Pusher) recordOK(status int) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
wasFirst := p.successHits == 0
|
||||
p.lastSentAt = time.Now().UTC()
|
||||
p.lastStatus = status
|
||||
p.lastErr = ""
|
||||
p.successHits++
|
||||
count := p.successHits
|
||||
p.mu.Unlock()
|
||||
|
||||
// First success is an operator signal that the push loop is live;
|
||||
// log it loud so the journal carries proof. Subsequent successes
|
||||
// log on a slow heartbeat (every 60 cycles) so the journal stays
|
||||
// quiet but still proves the loop hasn't drifted into "0 successes
|
||||
// but no errors either" territory.
|
||||
if wasFirst {
|
||||
p.log("info", "monitor push started", map[string]any{"status": status})
|
||||
} else if count%60 == 0 {
|
||||
p.log("info", "monitor push heartbeat", map[string]any{
|
||||
"successes": count, "status": status,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Pusher) recordErr(msg string) {
|
||||
|
||||
Reference in New Issue
Block a user