diff --git a/libs/tendermint/blockchain/v0/reactor.go b/libs/tendermint/blockchain/v0/reactor.go index d0b8914531..7c4c438451 100644 --- a/libs/tendermint/blockchain/v0/reactor.go +++ b/libs/tendermint/blockchain/v0/reactor.go @@ -383,6 +383,7 @@ FOR_LOOP: // TODO: same thing for app - but we would need a way to // get the hash without persisting the state var err error + bcR.curState, _, err = bcR.blockExec.ApplyBlockWithTrace(bcR.curState, firstID, first) // rpc if err != nil { // TODO This is bad, are we zombie? diff --git a/libs/tendermint/state/execution.go b/libs/tendermint/state/execution.go index 88ad426d33..3cac27ace6 100644 --- a/libs/tendermint/state/execution.go +++ b/libs/tendermint/state/execution.go @@ -208,6 +208,7 @@ func (blockExec *BlockExecutor) ApplyBlock( f, t := PprofStart() defer PprofEnd(int(block.Height), f, t) } + trc := trace.NewTracer(trace.ApplyBlock) trc.EnableSummary() trc.SetWorkloadStatistic(trace.GetApplyBlockWorkloadSttistic()) @@ -224,6 +225,7 @@ func (blockExec *BlockExecutor) ApplyBlock( now := time.Now().UnixNano() blockExec.metrics.IntervalTime.Set(float64(now-blockExec.metrics.lastBlockTime) / 1e6) blockExec.metrics.lastBlockTime = now + blockExec.metrics.CommittedHeight.Set(float64(block.Height)) }() if err := blockExec.ValidateBlock(state, block); err != nil { diff --git a/libs/tendermint/state/metrics.go b/libs/tendermint/state/metrics.go index ffa55c4c10..4133727381 100644 --- a/libs/tendermint/state/metrics.go +++ b/libs/tendermint/state/metrics.go @@ -27,6 +27,8 @@ type Metrics struct { AbciTime metrics.Gauge // Time during commiting app state CommitTime metrics.Gauge + + CommittedHeight metrics.Gauge } // PrometheusMetrics returns Metrics build using Prometheus client library. @@ -64,6 +66,12 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { Name: "block_commit_time", Help: "Time during commiting app state in ms.", }, labels).With(labelsAndValues...), + CommittedHeight: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "monitor_block_height", + Help: "The block height.", + }, labels).With(labelsAndValues...), } } @@ -75,5 +83,6 @@ func NopMetrics() *Metrics { lastBlockTime: time.Now().UnixNano(), AbciTime: discard.NewGauge(), CommitTime: discard.NewGauge(), + CommittedHeight: discard.NewGauge(), } }