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
}
duration := time.Since(start)
b.latencySlidingWindow.Add(float64(duration))
RecordBackendNetworkLatencyAverageSlidingWindow(b, b.latencySlidingWindow.Avg())
RecordBackendNetworkLatencyAverageSlidingWindow(b, time.Duration(b.latencySlidingWindow.Avg()))
sortBatchRPCResponse(rpcReqs, res)
return res, nil
......
......@@ -442,8 +442,8 @@ func RecordConsensusBackendUpdateDelay(b *Backend, delay time.Duration) {
consensusUpdateDelayBackend.WithLabelValues(b.Name).Set(float64(delay.Milliseconds()))
}
func RecordBackendNetworkLatencyAverageSlidingWindow(b *Backend, avgLatency float64) {
avgLatencyBackend.WithLabelValues(b.Name).Set(avgLatency)
func RecordBackendNetworkLatencyAverageSlidingWindow(b *Backend, avgLatency time.Duration) {
avgLatencyBackend.WithLabelValues(b.Name).Set(float64(avgLatency.Milliseconds()))
}
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