func monitorProbingStatus(s probing.Status, id string) { for { select { case <-time.After(statusMonitoringInterval): if !s.Health() { plog.Warningf("the connection to peer %s is unhealthy", id) } if s.ClockDiff() > time.Second { plog.Warningf("the clock difference against peer %s is too high [%v > %v]", id, s.ClockDiff(), time.Second) } rtts.WithLabelValues(id).Observe(s.SRTT().Seconds()) case <-s.StopNotify(): return } } }
func monitorProbingStatus(s probing.Status, id string) { // set the first interval short to log error early. interval := statusErrorInterval for { select { case <-time.After(interval): if !s.Health() { plog.Warningf("health check for peer %s could not connect: %v", id, s.Err()) interval = statusErrorInterval } else { interval = statusMonitoringInterval } if s.ClockDiff() > time.Second { plog.Warningf("the clock difference against peer %s is too high [%v > %v]", id, s.ClockDiff(), time.Second) } rtts.WithLabelValues(id).Observe(s.SRTT().Seconds()) case <-s.StopNotify(): return } } }