Skip to content

Commit

Permalink
add index label to prometheus metric
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoneLazzaris committed Feb 14, 2025
1 parent 3e5da06 commit 8012416
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions embedded/store/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
})
)

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 8012416

Please sign in to comment.