lib/storage: add vm_cache_size_bytes{type="storage/hour_metric_ids"} metric

This commit is contained in:
Aliaksandr Valialkin 2019-11-13 19:00:02 +02:00
parent 86a1cd700b
commit 119dfd01bb
2 changed files with 7 additions and 1 deletions

View File

@ -470,6 +470,9 @@ func registerStorageMetrics() {
metrics.NewGauge(`vm_cache_size_bytes{type="storage/date_metricID"}`, func() float64 {
return float64(m().DateMetricIDCacheSizeBytes)
})
metrics.NewGauge(`vm_cache_size_bytes{type="storage/hour_metric_ids"}`, func() float64 {
return float64(m().HourMetricIDCacheSizeBytes)
})
metrics.NewGauge(`vm_cache_size_bytes{type="indexdb/tagFilters"}`, func() float64 {
return float64(idbm().TagCacheSizeBytes)
})

View File

@ -310,7 +310,8 @@ type Metrics struct {
DateMetricIDCacheSyncsCount uint64
DateMetricIDCacheResetsCount uint64
HourMetricIDCacheSize uint64
HourMetricIDCacheSize uint64
HourMetricIDCacheSizeBytes uint64
IndexDBMetrics IndexDBMetrics
TableMetrics TableMetrics
@ -368,6 +369,8 @@ func (s *Storage) UpdateMetrics(m *Metrics) {
hourMetricIDsLen = hmCurr.m.Len()
}
m.HourMetricIDCacheSize += uint64(hourMetricIDsLen)
m.HourMetricIDCacheSizeBytes += hmCurr.m.SizeBytes()
m.HourMetricIDCacheSizeBytes += hmPrev.m.SizeBytes()
s.idb().UpdateMetrics(&m.IndexDBMetrics)
s.tb.UpdateMetrics(&m.TableMetrics)