diff --git a/handlers/callbacks.go b/handlers/callbacks.go index d9ccb520e..84f133ba5 100644 --- a/handlers/callbacks.go +++ b/handlers/callbacks.go @@ -35,6 +35,7 @@ func (tn *TendermintNetwork) newBlockCallback(chainState *types.ChainState, val // implements eventmeter.EventLatencyFunc func (tn *TendermintNetwork) latencyCallback(chain *types.ChainState, val *types.ValidatorState) eventmeter.LatencyCallbackFunc { return func(latency float64) { + latency = latency / 1000000.0 // ns to ms oldLatency := val.UpdateLatency(latency) chain.UpdateLatency(oldLatency, latency) } diff --git a/types/chain.go b/types/chain.go index 974ce4ad1..42a2e79fb 100644 --- a/types/chain.go +++ b/types/chain.go @@ -83,8 +83,8 @@ type BlockchainStatus struct { // Blockchain Info Height int `json:"height"` BlockchainSize int64 `json:"blockchain_size"` - MeanBlockTime float64 `json:"mean_block_time" wire:"unsafe"` - TxThroughput float64 `json:"tx_throughput" wire:"unsafe"` + MeanBlockTime float64 `json:"mean_block_time" wire:"unsafe"` // ms + TxThroughput float64 `json:"tx_throughput" wire:"unsafe"` // tx/s blockTimeMeter metrics.Meter txThroughputMeter metrics.Meter @@ -93,7 +93,7 @@ type BlockchainStatus struct { NumValidators int `json:"num_validators"` ActiveValidators int `json:"active_validators"` ActiveNodes int `json:"active_nodes"` - MeanLatency float64 `json:"mean_latency" wire:"unsafe"` + MeanLatency float64 `json:"mean_latency" wire:"unsafe"` // ms Uptime float64 `json:"uptime" wire:"unsafe"` // What else can we get / do we want? @@ -114,7 +114,7 @@ func (s *BlockchainStatus) NewBlock(block *tmtypes.Block) { s.Height = block.Header.Height s.blockTimeMeter.Mark(1) s.txThroughputMeter.Mark(int64(block.Header.NumTxs)) - s.MeanBlockTime = 1 / s.blockTimeMeter.RateMean() + s.MeanBlockTime = (1 / s.blockTimeMeter.RateMean()) * 1000 // 1/s to ms s.TxThroughput = s.txThroughputMeter.RateMean() } }