Improve logging for up/down changes
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
d51b6dc8e8
commit
feb2aa23ab
1 changed files with 14 additions and 4 deletions
|
@ -76,14 +76,24 @@ func (m Monitor) updateRoutingTargets(checker healthcheck.Checker) (err error) {
|
|||
}
|
||||
|
||||
if err := checker.Check(m.svc.HealthCheck.Settings, t); err != nil {
|
||||
if m.ipt.UnregisterServiceTarget(m.svc.Name, tgt) {
|
||||
logger.WithError(err).Warn("detected target down")
|
||||
changed = true
|
||||
} else {
|
||||
logger.WithError(err).Debug("detected target down")
|
||||
changed = changed || m.ipt.UnregisterServiceTarget(m.svc.Name, tgt)
|
||||
}
|
||||
|
||||
down = append(down, t.String())
|
||||
return
|
||||
}
|
||||
|
||||
if m.ipt.RegisterServiceTarget(m.svc.Name, tgt) {
|
||||
logger.Info("target up")
|
||||
changed = true
|
||||
} else {
|
||||
logger.Debug("target up")
|
||||
changed = changed || m.ipt.RegisterServiceTarget(m.svc.Name, tgt)
|
||||
}
|
||||
|
||||
up = append(up, t.String())
|
||||
}()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue