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 err := checker.Check(m.svc.HealthCheck.Settings, t); err != nil {
|
||||||
logger.WithError(err).Debug("detected target down")
|
if m.ipt.UnregisterServiceTarget(m.svc.Name, tgt) {
|
||||||
changed = changed || m.ipt.UnregisterServiceTarget(m.svc.Name, tgt)
|
logger.WithError(err).Warn("detected target down")
|
||||||
|
changed = true
|
||||||
|
} else {
|
||||||
|
logger.WithError(err).Debug("detected target down")
|
||||||
|
}
|
||||||
|
|
||||||
down = append(down, t.String())
|
down = append(down, t.String())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Debug("target up")
|
if m.ipt.RegisterServiceTarget(m.svc.Name, tgt) {
|
||||||
changed = changed || m.ipt.RegisterServiceTarget(m.svc.Name, tgt)
|
logger.Info("target up")
|
||||||
|
changed = true
|
||||||
|
} else {
|
||||||
|
logger.Debug("target up")
|
||||||
|
}
|
||||||
|
|
||||||
up = append(up, t.String())
|
up = append(up, t.String())
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue