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

Commit

Permalink
feat(prover): add some prover metrics for Alpha-4 protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Jul 16, 2023
1 parent af29c95 commit 6f05b76
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Push docker image to GCR"

on:
push:
branches: [main]
branches: [main,more-prover-metrics]
tags:
- "v*"

Expand Down
3 changes: 3 additions & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ var (
ProverSentProofCounter = metrics.NewRegisteredCounter("prover/proof/all/sent", nil)
ProverSentValidProofCounter = metrics.NewRegisteredCounter("prover/proof/valid/sent", nil)
ProverSentInvalidProofCounter = metrics.NewRegisteredCounter("prover/proof/invalid/sent", nil)
ProverProofsAssigned = metrics.NewRegisteredCounter("prover/proof/assigned", nil)
ProverSlashedCounter = metrics.NewRegisteredCounter("prover/slashed", nil)
ProverSlashedAmount = metrics.NewRegisteredCounter("prover/slashed/amount", nil)
ProverReceivedProposedBlockGauge = metrics.NewRegisteredGauge("prover/proposed/received", nil)
ProverReceivedProvenBlockGauge = metrics.NewRegisteredGauge("prover/proven/received", nil)
ProverAllProofRewardGauge = metrics.NewRegisteredGauge("prover/allProofReward", nil)
Expand Down
4 changes: 4 additions & 0 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ func (p *Prover) eventLoop() {
case e := <-p.proverSlashedCh:
if e.Addr.Hex() == p.proverAddress.Hex() {
log.Info("Prover slashed", "address", e.Addr.Hex(), "amount", e.Amount)
metrics.ProverSlashedCounter.Inc(1)
metrics.ProverSlashedAmount.Inc(int64(e.Amount))
}
case <-forceProvingTicker.C:
reqProving()
Expand Down Expand Up @@ -559,6 +561,8 @@ func (p *Prover) onBlockProposed(
"prover", block.AssignedProver.Hex(),
"proofWindowExpired", proofWindowExpired,
)

metrics.ProverProofsAssigned.Inc(1)
}

ctx, cancelCtx := context.WithCancel(ctx)
Expand Down

0 comments on commit 6f05b76

Please sign in to comment.