core/txpool/legacypool: add metric for accounts in txpool queue

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2026-01-19 23:42:47 +01:00
parent 0827d803d2
commit dece8b9369
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E
2 changed files with 4 additions and 0 deletions

View file

@ -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)
)

View file

@ -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)
}
}