Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(metrics): add some new metrics (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Dec 21, 2023
1 parent 8972ee1 commit cfeffca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
12 changes: 4 additions & 8 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions prover/proof_producer/sgx_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func (p *SGXProofProducer) RequestProof(
Tier: p.Tier(),
}

metrics.ProverSgxProofGeneratedCounter.Inc(1)

return nil
}

Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions prover/proof_producer/zkevm_rpcd_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ func (p *ZkevmRpcdProducer) RequestProof(
Tier: p.Tier(),
}

metrics.ProverPseProofGeneratedCounter.Inc(1)

return nil
}

Expand Down Expand Up @@ -248,8 +250,6 @@ func (p *ZkevmRpcdProducer) callProverDaemon(
return nil, 0, err
}

metrics.ProverPseProofGenerationTime.Update(int64(time.Since(start).Seconds()))

return proof, degree, nil
}

Expand Down
2 changes: 1 addition & 1 deletion prover/proof_submitter/proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (s *ProofSubmitter) SubmitProof(
return nil
}

metrics.ProverValidProofSubmissionErrorCounter.Inc(1)
metrics.ProverSubmissionErrorCounter.Inc(1)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion prover/proof_submitter/transaction/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cfeffca

Please sign in to comment.