From 812bda8b3abff2f690d9ebf8495d1d1ef08d3b11 Mon Sep 17 00:00:00 2001 From: Joshua Colvin Date: Tue, 10 Oct 2023 15:32:18 -0700 Subject: [PATCH 1/2] Add new metrics for inbox The following metrics are added to track the state currently read from inbox: * arb_inbox_batch * arb_inbox_message --- arbnode/inbox_tracker.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arbnode/inbox_tracker.go b/arbnode/inbox_tracker.go index c82e45fbee..414a9c94a7 100644 --- a/arbnode/inbox_tracker.go +++ b/arbnode/inbox_tracker.go @@ -15,7 +15,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/rlp" + "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/arbstate" "github.com/offchainlabs/nitro/arbutil" @@ -24,6 +26,11 @@ import ( "github.com/offchainlabs/nitro/util/containers" ) +var ( + inboxBatchGauge = metrics.NewRegisteredGauge("arb/inbox/batch", nil) + inboxMessageGauge = metrics.NewRegisteredGauge("arb/inbox/message", nil) +) + type InboxTracker struct { db ethdb.Database txStreamer *TransactionStreamer @@ -676,6 +683,8 @@ func (t *InboxTracker) AddSequencerBatches(ctx context.Context, client arbutil.L "l1Block", latestL1Block, "l1Timestamp", time.Unix(int64(latestTimestamp), 0), ) + inboxBatchGauge.Update(int64(pos)) + inboxMessageGauge.Update(int64(newMessageCount)) if t.validator != nil { t.validator.ReorgToBatchCount(startPos) From a778d5748b857595c1b055d5b8a1b8b630b3377c Mon Sep 17 00:00:00 2001 From: Joshua Colvin Date: Tue, 10 Oct 2023 16:57:30 -0700 Subject: [PATCH 2/2] Update metric names * arb_inbox_latest_batch * arb_inbox_latest_batch_message --- arbnode/inbox_tracker.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arbnode/inbox_tracker.go b/arbnode/inbox_tracker.go index 414a9c94a7..72e4ba2887 100644 --- a/arbnode/inbox_tracker.go +++ b/arbnode/inbox_tracker.go @@ -27,8 +27,8 @@ import ( ) var ( - inboxBatchGauge = metrics.NewRegisteredGauge("arb/inbox/batch", nil) - inboxMessageGauge = metrics.NewRegisteredGauge("arb/inbox/message", nil) + inboxLatestBatchGauge = metrics.NewRegisteredGauge("arb/inbox/latest/batch", nil) + inboxLatestBatchMessageGauge = metrics.NewRegisteredGauge("arb/inbox/latest/batch/message", nil) ) type InboxTracker struct { @@ -683,8 +683,8 @@ func (t *InboxTracker) AddSequencerBatches(ctx context.Context, client arbutil.L "l1Block", latestL1Block, "l1Timestamp", time.Unix(int64(latestTimestamp), 0), ) - inboxBatchGauge.Update(int64(pos)) - inboxMessageGauge.Update(int64(newMessageCount)) + inboxLatestBatchGauge.Update(int64(pos)) + inboxLatestBatchMessageGauge.Update(int64(newMessageCount)) if t.validator != nil { t.validator.ReorgToBatchCount(startPos)