mirror of https://github.com/vacp2p/nim-libp2p.git
Fix traffic metrics (#879)
This commit is contained in:
parent
4aa615c44c
commit
95e98e8c51
|
@ -103,11 +103,11 @@ method readOnce*(s: ChronosStream, pbytes: pointer, nbytes: int): Future[int] {.
|
||||||
withExceptions:
|
withExceptions:
|
||||||
result = await s.client.readOnce(pbytes, nbytes)
|
result = await s.client.readOnce(pbytes, nbytes)
|
||||||
s.activity = true # reset activity flag
|
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):
|
when defined(libp2p_agents_metrics):
|
||||||
s.trackPeerIdentity()
|
s.trackPeerIdentity()
|
||||||
if s.tracked:
|
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(
|
proc completeWrite(
|
||||||
s: ChronosStream, fut: Future[int], msgLen: int): Future[void] {.async.} =
|
s: ChronosStream, fut: Future[int], msgLen: int): Future[void] {.async.} =
|
||||||
|
|
Loading…
Reference in New Issue