From 95e98e8c51d57d041a9094b300cd884b35e87b95 Mon Sep 17 00:00:00 2001 From: Tanguy Date: Mon, 3 Apr 2023 14:37:23 +0200 Subject: [PATCH] Fix traffic metrics (#879) --- libp2p/stream/chronosstream.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libp2p/stream/chronosstream.nim b/libp2p/stream/chronosstream.nim index bf9515d..d2db6ce 100644 --- a/libp2p/stream/chronosstream.nim +++ b/libp2p/stream/chronosstream.nim @@ -103,11 +103,11 @@ method readOnce*(s: ChronosStream, pbytes: pointer, nbytes: int): Future[int] {. withExceptions: result = await s.client.readOnce(pbytes, nbytes) s.activity = true # reset activity flag - libp2p_network_bytes.inc(nbytes.int64, labelValues = ["in"]) + libp2p_network_bytes.inc(result.int64, labelValues = ["in"]) when defined(libp2p_agents_metrics): s.trackPeerIdentity() if s.tracked: - libp2p_peers_traffic_read.inc(nbytes.int64, labelValues = [s.shortAgent]) + libp2p_peers_traffic_read.inc(result.int64, labelValues = [s.shortAgent]) proc completeWrite( s: ChronosStream, fut: Future[int], msgLen: int): Future[void] {.async.} =