From cfeffca2d447d1e2c0eff059570dd94696c4bbf9 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 21 Dec 2023 10:35:07 +0800 Subject: [PATCH] feat(metrics): add some new metrics (#479) --- metrics/metrics.go | 12 ++++-------- prover/proof_producer/sgx_producer.go | 4 ++-- prover/proof_producer/zkevm_rpcd_producer.go | 4 ++-- prover/proof_submitter/proof_submitter.go | 2 +- prover/proof_submitter/transaction/sender.go | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/metrics/metrics.go b/metrics/metrics.go index 62d608f6c..f6e9b87b7 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -26,7 +26,6 @@ var ( ProposerProposeEpochCounter = metrics.NewRegisteredCounter("proposer/epoch", nil) ProposerProposedTxListsCounter = metrics.NewRegisteredCounter("proposer/proposed/txLists", nil) ProposerProposedTxsCounter = metrics.NewRegisteredCounter("proposer/proposed/txs", nil) - ProposerBlockFeeGauge = metrics.NewRegisteredGauge("proposer/blockFee", nil) // Prover ProverLatestVerifiedIDGauge = metrics.NewRegisteredGauge("prover/latestVerified/id", nil) @@ -37,13 +36,10 @@ var ( ProverProofsAssigned = metrics.NewRegisteredCounter("prover/proof/assigned", nil) ProverReceivedProposedBlockGauge = metrics.NewRegisteredGauge("prover/proposed/received", nil) ProverReceivedProvenBlockGauge = metrics.NewRegisteredGauge("prover/proven/received", nil) - ProverPseProofGenerationTime = metrics.NewRegisteredHistogram( - "prover/proof/pse/generation/time", - nil, - metrics.NewExpDecaySample(128, 0.015), - ) - ProverValidProofSubmissionAcceptedCounter = metrics.NewRegisteredCounter("prover/proof/submission/accepted", nil) - ProverValidProofSubmissionErrorCounter = metrics.NewRegisteredCounter("prover/proof/submission/error", nil) + ProverSubmissionAcceptedCounter = metrics.NewRegisteredCounter("prover/proof/submission/accepted", nil) + ProverSubmissionErrorCounter = metrics.NewRegisteredCounter("prover/proof/submission/error", nil) + ProverSgxProofGeneratedCounter = metrics.NewRegisteredCounter("prover/proof/sgx/generated", nil) + ProverPseProofGeneratedCounter = metrics.NewRegisteredCounter("prover/proof/pse/generated", nil) ) // Serve starts the metrics server on the given address, will be closed when the given diff --git a/prover/proof_producer/sgx_producer.go b/prover/proof_producer/sgx_producer.go index 504a8b074..3cb3087ac 100644 --- a/prover/proof_producer/sgx_producer.go +++ b/prover/proof_producer/sgx_producer.go @@ -112,6 +112,8 @@ func (p *SGXProofProducer) RequestProof( Tier: p.Tier(), } + metrics.ProverSgxProofGeneratedCounter.Inc(1) + return nil } @@ -155,8 +157,6 @@ func (p *SGXProofProducer) callProverDaemon(ctx context.Context, opts *ProofRequ return nil, err } - metrics.ProverPseProofGenerationTime.Update(int64(time.Since(start).Seconds())) - return proof, nil } diff --git a/prover/proof_producer/zkevm_rpcd_producer.go b/prover/proof_producer/zkevm_rpcd_producer.go index 8814f5858..062a1308f 100644 --- a/prover/proof_producer/zkevm_rpcd_producer.go +++ b/prover/proof_producer/zkevm_rpcd_producer.go @@ -192,6 +192,8 @@ func (p *ZkevmRpcdProducer) RequestProof( Tier: p.Tier(), } + metrics.ProverPseProofGeneratedCounter.Inc(1) + return nil } @@ -248,8 +250,6 @@ func (p *ZkevmRpcdProducer) callProverDaemon( return nil, 0, err } - metrics.ProverPseProofGenerationTime.Update(int64(time.Since(start).Seconds())) - return proof, degree, nil } diff --git a/prover/proof_submitter/proof_submitter.go b/prover/proof_submitter/proof_submitter.go index e1fc01190..bc5cf3a73 100644 --- a/prover/proof_submitter/proof_submitter.go +++ b/prover/proof_submitter/proof_submitter.go @@ -231,7 +231,7 @@ func (s *ProofSubmitter) SubmitProof( return nil } - metrics.ProverValidProofSubmissionErrorCounter.Inc(1) + metrics.ProverSubmissionErrorCounter.Inc(1) return err } diff --git a/prover/proof_submitter/transaction/sender.go b/prover/proof_submitter/transaction/sender.go index 79d04266a..e2b16660e 100644 --- a/prover/proof_submitter/transaction/sender.go +++ b/prover/proof_submitter/transaction/sender.go @@ -119,7 +119,7 @@ func (s *Sender) Send( "isContest", len(proofWithHeader.Proof) == 0, ) - metrics.ProverValidProofSubmissionAcceptedCounter.Inc(1) + metrics.ProverSubmissionAcceptedCounter.Inc(1) return nil }, s.backOffPolicy); err != nil {