mirror of https://github.com/minio/minio.git
Suppress metrics with zero values (#19638)
This would reduce the size of data in response of metrics listing. While graphing we can default these metrics with a zero value if not found. Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
This commit is contained in:
parent
6bb10a81a6
commit
6579304d8c
|
@ -232,10 +232,13 @@ func (m *MetricValues) Set(name MetricName, value float64, labels ...string) {
|
|||
if !ok {
|
||||
v = make([]metricValue, 0, 1)
|
||||
}
|
||||
m.values[name] = append(v, metricValue{
|
||||
Labels: labelMap,
|
||||
Value: value,
|
||||
})
|
||||
// If valid non zero value set the metrics
|
||||
if value > 0 {
|
||||
m.values[name] = append(v, metricValue{
|
||||
Labels: labelMap,
|
||||
Value: value,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// SetHistogram - sets values for the given MetricName using the provided
|
||||
|
@ -274,7 +277,10 @@ func (m *MetricValues) SetHistogram(name MetricName, hist *prometheus.HistogramV
|
|||
}
|
||||
}
|
||||
labels = append(labels, extraLabels...)
|
||||
m.Set(name, metric.Value, labels...)
|
||||
// If valid non zero value set the metrics
|
||||
if metric.Value > 0 {
|
||||
m.Set(name, metric.Value, labels...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue