Also log environment info

This commit is contained in:
Eric Lippmann 2021-05-25 16:25:04 +02:00
parent a1ffc53998
commit 372f5cae7c
2 changed files with 6 additions and 2 deletions

View file

@ -186,7 +186,7 @@ func (h *HA) realize(s *icingaredisv1.IcingaStatus, t *types.UnixMilli, shouldLo
}
if shouldLog {
h.logger.Infow("Another instance is active", "instance_id", instance.Id, "heartbeat", instance.Heartbeat, zap.Duration("heartbeat_age", time.Now().Sub(instance.Heartbeat.Time())))
h.logger.Infow("Another instance is active", "instance_id", instance.Id, zap.String("environment", s.Environment), "heartbeat", instance.Heartbeat, zap.Duration("heartbeat_age", time.Now().Sub(instance.Heartbeat.Time())))
}
takeover = false
break

View file

@ -112,7 +112,11 @@ func (h Heartbeat) controller() {
select {
case m := <-messages:
if !h.active {
h.logger.Info("Received first Icinga 2 heartbeat")
s, err := m.IcingaStatus()
if err != nil {
return err
}
h.logger.Infow("Received first Icinga 2 heartbeat", zap.String("environment", s.Environment))
h.active = true
}
h.beat <- m