From 8012416de19e94ba377f41e83f859587795f1ad0 Mon Sep 17 00:00:00 2001 From: Simone Lazzaris Date: Fri, 14 Feb 2025 08:52:16 +0100 Subject: [PATCH] add index label to prometheus metric --- embedded/store/indexer.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/embedded/store/indexer.go b/embedded/store/indexer.go index b33e68a1d5..7ba8873716 100644 --- a/embedded/store/indexer.go +++ b/embedded/store/indexer.go @@ -92,12 +92,14 @@ var ( Help: "The highest id of indexed transaction", }, []string{ "db", + "index", }) metricsLastCommittedTrx = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "immudb_last_committed_trx_id", Help: "The highest id of committed transaction", }, []string{ "db", + "index", }) ) @@ -179,8 +181,9 @@ func newIndexer(path string, store *ImmuStore, opts *Options) (*indexer, error) } dbName := filepath.Base(store.path) - indexer.metricsLastIndexedTrx = metricsLastIndexedTrxId.WithLabelValues(dbName) - indexer.metricsLastCommittedTrx = metricsLastCommittedTrx.WithLabelValues(dbName) + idxName := filepath.Base(path) + indexer.metricsLastIndexedTrx = metricsLastIndexedTrxId.WithLabelValues(dbName, idxName) + indexer.metricsLastCommittedTrx = metricsLastCommittedTrx.WithLabelValues(dbName, idxName) return indexer, nil }