mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
guard against NaN
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package stats
|
||||
|
||||
import (
|
||||
"math"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
@@ -117,6 +118,12 @@ func (h *HostStatsCollector) Collect() (*HostStats, error) {
|
||||
UsedPercent: usage.UsedPercent,
|
||||
InodesUsedPercent: usage.InodesUsedPercent,
|
||||
}
|
||||
if math.IsNaN(ds.UsedPercent) {
|
||||
ds.UsedPercent = 0.0
|
||||
}
|
||||
if math.IsNaN(ds.InodesUsedPercent) {
|
||||
ds.InodesUsedPercent = 0.0
|
||||
}
|
||||
diskStats = append(diskStats, &ds)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user