Add cache usage, total capacity to prometheus metrics (#11026)

This commit is contained in:
Poorna Krishnamoorthy
2020-12-07 16:35:11 -08:00
committed by GitHub
parent 934bed47fa
commit f3beb1236a
4 changed files with 30 additions and 0 deletions
+20
View File
@@ -280,6 +280,26 @@ func cacheMetricsPrometheus(ch chan<- prometheus.Metric) {
float64(cdStats.UsageState),
cdStats.Dir,
)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName("cache", "usage", "size"),
"Indicates current cache usage in bytes",
[]string{"disk"}, nil),
prometheus.GaugeValue,
float64(cdStats.UsageSize),
cdStats.Dir,
)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName("cache", "total", "size"),
"Indicates total size of cache disk",
[]string{"disk"}, nil),
prometheus.GaugeValue,
float64(cdStats.TotalCapacity),
cdStats.Dir,
)
}
}