Fix disk cache usage percent for prometheus (#10898)

Fixes: #10895

Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
This commit is contained in:
Poorna Krishnamoorthy 2020-11-14 19:18:00 -08:00 committed by GitHub
parent b5a3d79bce
commit d295ce5708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,9 +205,9 @@ func (c *diskCache) diskUsageLow() bool {
logger.LogIf(ctx, err)
return false
}
usedPercent := (di.Used / di.Total) * 100
usedPercent := float64(di.Used) * 100 / float64(di.Total)
low := int(usedPercent) < gcStopPct
atomic.StoreUint64(&c.stats.UsagePercent, usedPercent)
atomic.StoreUint64(&c.stats.UsagePercent, uint64(usedPercent))
if low {
atomic.StoreInt32(&c.stats.UsageState, 0)
}