Commit 85520524 authored by felipe andrade's avatar felipe andrade Committed by GitHub

normalize latency in ms (#5783)

parent 3fe363fb
...@@ -482,7 +482,7 @@ func (b *Backend) doForward(ctx context.Context, rpcReqs []*RPCReq, isBatch bool ...@@ -482,7 +482,7 @@ func (b *Backend) doForward(ctx context.Context, rpcReqs []*RPCReq, isBatch bool
} }
duration := time.Since(start) duration := time.Since(start)
b.latencySlidingWindow.Add(float64(duration)) b.latencySlidingWindow.Add(float64(duration))
RecordBackendNetworkLatencyAverageSlidingWindow(b, b.latencySlidingWindow.Avg()) RecordBackendNetworkLatencyAverageSlidingWindow(b, time.Duration(b.latencySlidingWindow.Avg()))
sortBatchRPCResponse(rpcReqs, res) sortBatchRPCResponse(rpcReqs, res)
return res, nil return res, nil
......
...@@ -442,8 +442,8 @@ func RecordConsensusBackendUpdateDelay(b *Backend, delay time.Duration) { ...@@ -442,8 +442,8 @@ func RecordConsensusBackendUpdateDelay(b *Backend, delay time.Duration) {
consensusUpdateDelayBackend.WithLabelValues(b.Name).Set(float64(delay.Milliseconds())) consensusUpdateDelayBackend.WithLabelValues(b.Name).Set(float64(delay.Milliseconds()))
} }
func RecordBackendNetworkLatencyAverageSlidingWindow(b *Backend, avgLatency float64) { func RecordBackendNetworkLatencyAverageSlidingWindow(b *Backend, avgLatency time.Duration) {
avgLatencyBackend.WithLabelValues(b.Name).Set(avgLatency) avgLatencyBackend.WithLabelValues(b.Name).Set(float64(avgLatency.Milliseconds()))
} }
func RecordBackendNetworkRequestCountSlidingWindow(b *Backend, count uint) { func RecordBackendNetworkRequestCountSlidingWindow(b *Backend, count uint) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment