Skip to content

Commit

Permalink
Fix excessive warnings about unknown poll status
Browse files Browse the repository at this point in the history
Unknown pollstatus was being logged when we had PollStatusUnknown since
it is represented by NaN which is not comparable. This didn't effect
metrics, but was noisy.
  • Loading branch information
wrouesnel committed Aug 11, 2022
1 parent cccfed1 commit 4593eaf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/pollers/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ func (s *Host) Collect(ch chan<- prometheus.Metric) {
s.PathReachable.Collect(ch)

//Latency
switch s.pingStatus {
case PollStatusUnknown:
s.PingLatency.Set(math.NaN())
case PollStatusFailed:
switch {
case s.pingStatus == PollStatusFailed:
s.PingLatency.Set(math.Inf(1))
case PollStatusSuccess:
case s.pingStatus == PollStatusSuccess:
s.PingLatency.Set(float64(s.pingLatency / time.Microsecond))
case math.IsNaN(float64(s.pingStatus)):
s.PingLatency.Set(math.NaN())
default:
s.log().Warn("Unknown PollStatus value returned")
s.PingLatency.Set(float64(s.pingLatency / time.Microsecond))
Expand Down

0 comments on commit 4593eaf

Please sign in to comment.