Merge pull request #1320 from hashicorp/b-nan

Guard against NaN in disk stats
This commit is contained in:
Alex Dadgar 2016-06-20 10:39:18 -07:00 committed by GitHub
commit becaeb6835

View file

@ -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)
}
}