Skip to content

Commit

Permalink
Merge pull request #1320 from hashicorp/b-nan
Browse files Browse the repository at this point in the history
Guard against NaN in disk stats
  • Loading branch information
dadgar authored Jun 20, 2016
2 parents 670af92 + 0b3a39b commit 3c578fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/stats/host.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package stats

import (
"math"
"runtime"
"time"

Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 3c578fc

Please sign in to comment.