Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 9708f3f

Browse files
committed
Add log for bs load duration
1 parent 46f4e84 commit 9708f3f

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

internal/consensus/metrics.gen.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/consensus/metrics.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Metrics struct {
2626

2727
GossipDataCount metrics.Counter `metrics_labels:"peer_id, branch"`
2828
GossipVotesCount metrics.Counter `metrics_labels:"peer_id, branch"`
29+
GossipVotesCountDuration metrics.Gauge `metrics_labels:"peer_id"`
2930

3031
// Last height signed by this validator if the node is a validator.
3132
ValidatorLastSignedHeight metrics.Gauge `metrics_labels:"validator_address"`

internal/consensus/reactor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,10 @@ func (r *Reactor) gossipVotesRoutine(ctx context.Context, ps *PeerState, voteCh
773773
}()
774774

775775
logCounter := 0
776+
prevTime := time.Now()
776777
for {
778+
r.Metrics.GossipVotesCountDuration.With("peer_id", string(ps.peerID)).Set(time.Now().Sub(prevTime).Seconds())
779+
prevTime = time.Now()
777780
if !r.IsRunning() {
778781
r.logger.Error("[TMDEBUG] gossipVotesRoutine reactor not running", "peer", ps.peerID)
779782
return
@@ -824,15 +827,18 @@ func (r *Reactor) gossipVotesRoutine(ctx context.Context, ps *PeerState, voteCh
824827
blockStoreBase := r.state.blockStore.Base()
825828
enteredCatchup := false
826829
if blockStoreBase > 0 && prs.Height != 0 && rs.Height >= prs.Height+2 && prs.Height >= blockStoreBase {
830+
827831
enteredCatchup = true
828832
// Load the block's extended commit for prs.Height, which contains precommit
829833
// signatures for prs.Height.
834+
loadBlockStoreStart := time.Now()
830835
var ec *types.ExtendedCommit
831836
if r.state.state.ConsensusParams.ABCI.VoteExtensionsEnabled(prs.Height) {
832837
ec = r.state.blockStore.LoadBlockExtendedCommit(prs.Height)
833838
} else {
834839
ec = r.state.blockStore.LoadBlockCommit(prs.Height).WrappedExtendedCommit()
835840
}
841+
r.logger.Info("[TMDEBUG] finished loading block store for catchup", "durationMs", time.Now().Sub(loadBlockStoreStart).Milliseconds())
836842
if ec == nil {
837843
r.Metrics.GossipVotesCount.With(
838844
"peer_id", string(ps.peerID),

0 commit comments

Comments
 (0)