Skip to content

Commit

Permalink
traces precommit time table
Browse files Browse the repository at this point in the history
  • Loading branch information
staheri14 committed Jul 31, 2024
1 parent 8a90067 commit a7468f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2323,6 +2323,7 @@ func (cs *State) signAddVote(msgType cmtproto.SignedMsgType, hash []byte, header
targetBlockTime := 11 * time.Second
precommitVoteTime := cs.StartTime.Add(targetBlockTime)
waitTime := precommitVoteTime.Sub(cmttime.Now())
schema.WritePreCommitTime(cs.traceClient, cs.Height, cs.Round, waitTime.Seconds())
if waitTime > 0 {
if waitTime > 11*time.Second {
cs.Logger.Debug("waiting for precommit vote was higher than"+
Expand Down
20 changes: 20 additions & 0 deletions pkg/trace/schema/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ func ConsensusTables() []string {
}
}

const (
// PrecommitTime
PrecommitTime = "precommit_time"
)

type PreCommitTime struct {
Height int64 `json:"height"`
Round int32 `json:"round"`
Delay float64 `json:"delay"`
}

func (p PreCommitTime) Table() string {
return PrecommitTime
}

func WritePreCommitTime(client trace.Tracer, height int64, round int32, delay float64) {
client.Write(PreCommitTime{Height: height, Round: round, Delay: delay})

}

// Schema constants for the consensus round state tracing database.
const (
// RoundStateTable is the name of the table that stores the consensus
Expand Down

0 comments on commit a7468f6

Please sign in to comment.