From 08f21d87614a11d99d1271da5c7a46fe1bbc792e Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 10 Feb 2021 16:53:26 +0200 Subject: [PATCH] app/vmstorage: export vm_composite_index_min_timestamp metric --- app/vmstorage/main.go | 3 +++ lib/storage/index_db.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/app/vmstorage/main.go b/app/vmstorage/main.go index 48e76d87a0..fe1126ef34 100644 --- a/app/vmstorage/main.go +++ b/app/vmstorage/main.go @@ -329,6 +329,9 @@ func registerStorageMetrics(strg *storage.Storage) { metrics.NewGauge(`vm_index_blocks_with_metric_ids_incorrect_order_total`, func() float64 { return float64(idbm().IndexBlocksWithMetricIDsIncorrectOrder) }) + metrics.NewGauge(`vm_composite_index_min_timestamp`, func() float64 { + return float64(idbm().MinTimestampForCompositeIndex) / 1e3 + }) metrics.NewGauge(`vm_assisted_merges_total{type="storage/small"}`, func() float64 { return float64(tm().SmallAssistedMerges) diff --git a/lib/storage/index_db.go b/lib/storage/index_db.go index 5af72db730..f52895d562 100644 --- a/lib/storage/index_db.go +++ b/lib/storage/index_db.go @@ -203,6 +203,8 @@ type IndexDBMetrics struct { IndexBlocksWithMetricIDsProcessed uint64 IndexBlocksWithMetricIDsIncorrectOrder uint64 + MinTimestampForCompositeIndex uint64 + mergeset.TableMetrics } @@ -244,6 +246,8 @@ func (db *indexDB) UpdateMetrics(m *IndexDBMetrics) { m.IndexBlocksWithMetricIDsProcessed = atomic.LoadUint64(&indexBlocksWithMetricIDsProcessed) m.IndexBlocksWithMetricIDsIncorrectOrder = atomic.LoadUint64(&indexBlocksWithMetricIDsIncorrectOrder) + m.MinTimestampForCompositeIndex = uint64(db.minTimestampForCompositeIndex) + db.tb.UpdateMetrics(&m.TableMetrics) db.doExtDB(func(extDB *indexDB) { extDB.tb.UpdateMetrics(&m.TableMetrics)