Skip to content

Commit

Permalink
chore(taiko-client): add more proof generation metrics (#18715)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Jan 6, 2025
1 parent 6157af5 commit ae07365
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/taiko-client/internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,33 @@ var (
ProverAggregationSubmissionErrorCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_aggregation_submission_error",
})
ProverAggregationGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_aggregation_generation_time",
})
ProverSgxProofGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_sgx_generated",
})
ProverSgxProofGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_sgx_generation_time",
})
ProverSgxProofAggregationGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_sgx_aggregation_generated",
})
ProverR0ProofGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_r0_generated",
})
ProverR0ProofGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_r0_generation_time",
})
ProverR0ProofAggregationGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_r0_aggregation_generated",
})
ProverSp1ProofGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_sp1_generated",
})
ProverSP1ProofGenerationTime = factory.NewGauge(prometheus.GaugeOpts{
Name: "prover_proof_sp1_generation_time",
})
ProverSp1ProofAggregationGeneratedCounter = factory.NewCounter(prometheus.CounterOpts{
Name: "prover_proof_sp1_aggregation_generated",
})
Expand Down
11 changes: 9 additions & 2 deletions packages/taiko-client/proposer/transaction_builder/fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,15 @@ func (b *TxBuilderWithFallback) BuildOntake(
return b.blobTransactionBuilder.BuildOntake(ctx, txListBytesArray)
}

metrics.ProposerEstimatedCostCalldata.Set(float64(costCalldata.Uint64()))
metrics.ProposerEstimatedCostBlob.Set(float64(costBlob.Uint64()))
var (
costCalldataFloat64 float64
costBlobFloat64 float64
)
costCalldataFloat64, _ = utils.WeiToEther(costCalldata).Float64()
costBlobFloat64, _ = utils.WeiToEther(costBlob).Float64()

metrics.ProposerEstimatedCostCalldata.Set(costCalldataFloat64)
metrics.ProposerEstimatedCostBlob.Set(costBlobFloat64)

if costCalldata.Cmp(costBlob) < 0 {
log.Info("Building a type-2 transaction", "costCalldata", costCalldata, "costBlob", costBlob)
Expand Down
2 changes: 2 additions & 0 deletions packages/taiko-client/prover/proof_producer/sgx_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ func (s *SGXProofProducer) requestBatchProof(
"time", time.Since(requestAt),
"producer", "SGXProofProducer",
)
metrics.ProverAggregationGenerationTime.Set(float64(time.Since(requestAt).Seconds()))

return proof, nil
}
Expand Down Expand Up @@ -390,6 +391,7 @@ func (s *SGXProofProducer) callProverDaemon(
"time", time.Since(requestAt),
"producer", "SGXProofProducer",
)
metrics.ProverSgxProofGenerationTime.Set(float64(time.Since(requestAt).Seconds()))

return proof, nil
}
Expand Down
5 changes: 5 additions & 0 deletions packages/taiko-client/prover/proof_producer/zkvm_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ func (s *ZKvmProofProducer) callProverDaemon(
"time", time.Since(requestAt),
"producer", "ZKvmProofProducer",
)
if s.ZKProofType == ZKProofTypeR0 {
metrics.ProverR0ProofGenerationTime.Set(float64(time.Since(requestAt).Seconds()))
} else if s.ZKProofType == ZKProofTypeSP1 {
metrics.ProverSP1ProofGenerationTime.Set(float64(time.Since(requestAt).Seconds()))
}

return proof, nil
}
Expand Down

0 comments on commit ae07365

Please sign in to comment.