diff --git a/block/manager.go b/block/manager.go index 649a1d432..bd7e8cb13 100644 --- a/block/manager.go +++ b/block/manager.go @@ -385,6 +385,7 @@ func (m *Manager) SyncTargetLoop(ctx context.Context) { // updateSyncParams updates the sync target and state index if necessary func (m *Manager) updateSyncParams(ctx context.Context, endHeight uint64) { + rollappHubHeightGauge.Set(float64(endHeight)) m.logger.Info("Received new syncTarget", "syncTarget", endHeight) atomic.StoreUint64(&m.syncTarget, endHeight) atomic.StoreInt64(&m.lastSubmissionTime, time.Now().UnixNano()) @@ -707,6 +708,7 @@ func (m *Manager) produceBlock(ctx context.Context, allowEmpty bool) error { } m.logger.Info("block created", "height", newHeight, "num_tx", len(block.Data.Txs)) + rollappHeightGauge.Set(float64(newHeight)) //TODO: move to separate function lastSubmissionTime := atomic.LoadInt64(&m.lastSubmissionTime) diff --git a/block/metrics.go b/block/metrics.go new file mode 100644 index 000000000..430a428c2 --- /dev/null +++ b/block/metrics.go @@ -0,0 +1,15 @@ +package block + +import ( + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" +) + +var rollappHeightGauge = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "rollapp_height", + Help: "The height of the local rollapp", +}) +var rollappHubHeightGauge = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "rollapp_hub_height", + Help: "The latest height of the Rollapp that has been synced to the hub.", +})