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 31376fd353
commit d297b65089
2 changed files with 7 additions and 1 deletions

View File

@ -415,6 +415,9 @@ func registerStorageMetrics(strg *storage.Storage) {
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

@ -321,6 +321,7 @@ type Metrics struct {
DateMetricIDCacheResetsCount uint64
HourMetricIDCacheSize uint64
HourMetricIDCacheSizeBytes uint64
IndexDBMetrics IndexDBMetrics
TableMetrics TableMetrics
@ -378,6 +379,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)