Merge pull request #1320 from hashicorp/b-nan
Guard against NaN in disk stats
This commit is contained in:
commit
becaeb6835
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue