From 736d850be1b17990ac5f5c756bf44c440488983e Mon Sep 17 00:00:00 2001 From: colin <102356659+colinlyguo@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:46:20 +0800 Subject: [PATCH] feat(l2-watcher): add nil row consumption block metric (#1518) --- common/version/version.go | 2 +- rollup/internal/controller/watcher/l2_watcher.go | 1 + rollup/internal/controller/watcher/l2_watcher_metrics.go | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/version/version.go b/common/version/version.go index 1f1ce66eb3..517f32c2a6 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -5,7 +5,7 @@ import ( "runtime/debug" ) -var tag = "v4.4.60" +var tag = "v4.4.61" var commit = func() string { if info, ok := debug.ReadBuildInfo(); ok { diff --git a/rollup/internal/controller/watcher/l2_watcher.go b/rollup/internal/controller/watcher/l2_watcher.go index 3555b667e1..922c65d850 100644 --- a/rollup/internal/controller/watcher/l2_watcher.go +++ b/rollup/internal/controller/watcher/l2_watcher.go @@ -127,6 +127,7 @@ func (w *L2WatcherClient) getAndStoreBlocks(ctx context.Context, from, to uint64 return fmt.Errorf("failed to GetBlockByNumberOrHash: %v. number: %v", err, number) } if block.RowConsumption == nil { + w.metrics.fetchNilRowConsumptionBlockTotal.Inc() return fmt.Errorf("fetched block does not contain RowConsumption. number: %v", number) } diff --git a/rollup/internal/controller/watcher/l2_watcher_metrics.go b/rollup/internal/controller/watcher/l2_watcher_metrics.go index c9f575be88..34408ae66d 100644 --- a/rollup/internal/controller/watcher/l2_watcher_metrics.go +++ b/rollup/internal/controller/watcher/l2_watcher_metrics.go @@ -12,6 +12,7 @@ type l2WatcherMetrics struct { fetchRunningMissingBlocksHeight prometheus.Gauge rollupL2BlocksFetchedGap prometheus.Gauge rollupL2BlockL1CommitCalldataSize prometheus.Gauge + fetchNilRowConsumptionBlockTotal prometheus.Counter } var ( @@ -38,6 +39,10 @@ func initL2WatcherMetrics(reg prometheus.Registerer) *l2WatcherMetrics { Name: "rollup_l2_block_l1_commit_calldata_size", Help: "The l1 commitBatch calldata size of the l2 block", }), + fetchNilRowConsumptionBlockTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ + Name: "rollup_l2_watcher_fetch_nil_row_consumption_block_total", + Help: "The total number of occurrences where a fetched block has nil RowConsumption", + }), } }) return l2WatcherMetric