Skip to content

Commit 98849e3

Browse files
authored
is committer live metric (#300)
1 parent 821798a commit 98849e3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

internal/committer/poollatest.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ func pollLatest() error {
7676
nextBlockNumber = expectedBlockNumber
7777
metrics.CommitterNextBlockNumber.WithLabelValues(indexerName, chainIdStr).Set(float64(nextBlockNumber))
7878

79+
if config.Cfg.CommitterIsLive {
80+
metrics.CommitterIsLive.WithLabelValues(indexerName, chainIdStr).Set(1)
81+
}
82+
7983
if !config.Cfg.CommitterIsLive && latestBlock.Int64()-int64(nextBlockNumber) < 20 && !hasRightsized {
8084
log.Debug().
8185
Uint64("latest_block", latestBlock.Uint64()).

internal/metrics/metrics.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,9 @@ var (
9494
Name: "committer_rpc_retries_total",
9595
Help: "The total number of RPC retries",
9696
}, []string{"project_name", "chain_id"})
97+
98+
CommitterIsLive = promauto.NewGaugeVec(prometheus.GaugeOpts{
99+
Name: "committer_is_live",
100+
Help: "Whether the committer is live",
101+
}, []string{"project_name", "chain_id"})
97102
)

0 commit comments

Comments
 (0)