Do not issue freespace metric when free-space is 0.

This commit is contained in:
Hector Sanjuan 2022-05-03 18:39:44 +02:00
parent 0b25f9ce60
commit 060ef812b2

View File

@ -127,8 +127,12 @@ func (disk *Informer) GetMetrics(ctx context.Context) []api.Metric {
total := repoStat.StorageMax
if size < total {
metric = total - size
} else { // Make sure we don't underflow
} else {
// Make sure we don't underflow and stop
// sending this metric when space is exhausted.
metric = 0
valid = false
logger.Warn("reported freespace is 0")
}
case MetricRepoSize:
metric = repoStat.RepoSize