Skip to content

Commit

Permalink
Track rounds required to produce new block (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtek-coreum authored Feb 14, 2024
1 parent bfd158f commit 21435cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions modules/actions/logging/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ var ValidatorBlockMismatchCounter = prometheus.NewCounter(
},
)

// BlockRoundSummary represents the Telemetry summary used to track block proposal rounds
var BlockRoundSummary = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "bdjuno_block_round",
Help: "Counts block rounds.",
}, []string{
"round",
},
)

func init() {
for _, c := range []prometheus.Collector{
ActionResponseTime,
Expand All @@ -64,6 +74,7 @@ func init() {
BlockTimeGauge,
ProposalSummary,
ValidatorBlockMismatchCounter,
BlockRoundSummary,
} {
if err := prometheus.Register(c); err != nil {
panic(err)
Expand Down
4 changes: 3 additions & 1 deletion modules/consensus/handle_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package consensus
import (
"bytes"
"fmt"
"strconv"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/forbole/bdjuno/v4/modules/actions/logging"
Expand All @@ -24,8 +25,9 @@ func (m *Module) HandleBlock(
Err(err).Msg("error while updating block time from genesis")
}

m.countProposalsByValidator(b, vals)
logging.BlockRoundSummary.WithLabelValues(strconv.Itoa(int(b.Block.LastCommit.Round))).Observe(1.0)

m.countProposalsByValidator(b, vals)
return nil
}

Expand Down

0 comments on commit 21435cd

Please sign in to comment.