Skip to content

Commit

Permalink
feat(taiko-client): add proposer_pool_content_fetch_time metric (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Sep 30, 2024
1 parent 8fae6e0 commit 35579df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/taiko-client/internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
ProposerProposeEpochCounter = factory.NewCounter(prometheus.CounterOpts{Name: "proposer_epoch"})
ProposerProposedTxListsCounter = factory.NewCounter(prometheus.CounterOpts{Name: "proposer_proposed_txLists"})
ProposerProposedTxsCounter = factory.NewCounter(prometheus.CounterOpts{Name: "proposer_proposed_txs"})
ProposerPoolContentFetchTime = factory.NewGauge(prometheus.GaugeOpts{Name: "proposer_pool_content_fetch_time"})

// Prover
ProverLatestVerifiedIDGauge = factory.NewGauge(prometheus.GaugeOpts{Name: "prover_latestVerified_id"})
Expand Down
7 changes: 6 additions & 1 deletion packages/taiko-client/proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ func (p *Proposer) Close(_ context.Context) {

// fetchPoolContent fetches the transaction pool content from L2 execution engine.
func (p *Proposer) fetchPoolContent(filterPoolContent bool) ([]types.Transactions, error) {
minTip := p.MinTip
var (
minTip = p.MinTip
startAt = time.Now()
)
// If `--epoch.allowZeroInterval` flag is set, allow proposing zero tip transactions once when
// the total epochs number is divisible by the flag value.
if p.AllowZeroInterval > 0 && p.totalEpochs%p.AllowZeroInterval == 0 {
Expand All @@ -206,6 +209,8 @@ func (p *Proposer) fetchPoolContent(filterPoolContent bool) ([]types.Transaction
return nil, fmt.Errorf("failed to fetch transaction pool content: %w", err)
}

metrics.ProposerPoolContentFetchTime.Set(time.Since(startAt).Seconds())

txLists := []types.Transactions{}
for i, txs := range preBuiltTxList {
// Filter the pool content if the filterPoolContent flag is set.
Expand Down

0 comments on commit 35579df

Please sign in to comment.