diff --git a/modules/actions/logging/prometheus.go b/modules/actions/logging/prometheus.go index 0bdc0f8d4..6b844d779 100644 --- a/modules/actions/logging/prometheus.go +++ b/modules/actions/logging/prometheus.go @@ -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, @@ -64,6 +74,7 @@ func init() { BlockTimeGauge, ProposalSummary, ValidatorBlockMismatchCounter, + BlockRoundSummary, } { if err := prometheus.Register(c); err != nil { panic(err) diff --git a/modules/consensus/handle_block.go b/modules/consensus/handle_block.go index fcef42bfa..df29ed64c 100644 --- a/modules/consensus/handle_block.go +++ b/modules/consensus/handle_block.go @@ -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" @@ -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 }