Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(taiko-client): add proposer_pool_content_fetch_time metric #18190

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading