From dece8b936930603a5a61007cab61e093710ea5f0 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Mon, 19 Jan 2026 23:42:47 +0100 Subject: [PATCH] core/txpool/legacypool: add metric for accounts in txpool queue Signed-off-by: Csaba Kiraly --- core/txpool/legacypool/legacypool.go | 1 + core/txpool/legacypool/queue.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 53bde5d0bc..53800d27aa 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -115,6 +115,7 @@ var ( slotsGauge = metrics.NewRegisteredGauge("txpool/slots", nil) pendingAddrsGauge = metrics.NewRegisteredGauge("txpool/pending/accounts", nil) + queuedAddrsGauge = metrics.NewRegisteredGauge("txpool/queued/accounts", nil) reheapTimer = metrics.NewRegisteredTimer("txpool/reheap", nil) ) diff --git a/core/txpool/legacypool/queue.go b/core/txpool/legacypool/queue.go index a889debe37..918a219ab6 100644 --- a/core/txpool/legacypool/queue.go +++ b/core/txpool/legacypool/queue.go @@ -114,6 +114,7 @@ func (q *queue) remove(addr common.Address, tx *types.Transaction) { if future.Empty() { delete(q.queued, addr) delete(q.beats, addr) + queuedAddrsGauge.Dec(1) } } } @@ -123,6 +124,7 @@ func (q *queue) add(tx *types.Transaction) (*common.Hash, error) { from, _ := types.Sender(q.signer, tx) // already validated if q.queued[from] == nil { q.queued[from] = newList(false) + queuedAddrsGauge.Inc(1) } inserted, old := q.queued[from].Add(tx, q.config.PriceBump) if !inserted { @@ -200,6 +202,7 @@ func (q *queue) promoteExecutables(accounts []common.Address, gasLimit uint64, c if list.Empty() { delete(q.queued, addr) delete(q.beats, addr) + queuedAddrsGauge.Dec(1) removedAddresses = append(removedAddresses, addr) } }