Skip to content

Commit

Permalink
add metrics for bottleneck of txpool: 1. tx packet size from p2p network
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhang2023 committed Nov 15, 2024
1 parent c2ab741 commit 6977830
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eth/handler_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var (
var enqueueTx = make(chan func(), TxQueueSize)
var parallelCounter int32 = 0
var parallelCounterGuage = metrics.NewRegisteredGauge("p2p/enqueue/parallel", nil)
var txPackSizeGuage = metrics.NewRegisteredGauge("p2p/enqueue/tx/pack/size", nil)

func init() {
log.Info("P2P euqneue parallel thread number", "threadNum", TxQueueSize)
Expand Down Expand Up @@ -145,6 +146,9 @@ func asyncEnqueueTx(peer *eth.Peer, txs []*types.Transaction, fetcher *fetcher.T
return err
}
enqueueTx <- func() {
if metrics.EnabledExpensive {
txPackSizeGuage.Update(int64(len(txs)))
}
if err := fetcher.Enqueue(peer.ID(), txs, directed); err != nil {
peer.Log().Warn("Failed to enqueue transaction", "err", err)
}
Expand Down

0 comments on commit 6977830

Please sign in to comment.