mirror of https://github.com/status-im/nim-eth.git
add discv5_network_byte metric in discoveryv5 protocol
This commit is contained in:
parent
bb5cb6a4d0
commit
ad8f678657
|
@ -91,6 +91,7 @@ import
|
|||
export
|
||||
options, results, node, enr, encoding.maxDiscv5PacketSize
|
||||
|
||||
declareCounter discv5_network_bytes, "discv5 traffic", labels = ["direction"]
|
||||
declareCounter discovery_message_requests_outgoing,
|
||||
"Discovery protocol outgoing message requests", labels = ["response"]
|
||||
declareCounter discovery_message_requests_incoming,
|
||||
|
@ -276,6 +277,8 @@ proc sendTo(d: Protocol, a: Address, data: seq[byte]): Future[void] {.async.} =
|
|||
# because of ping failures due to own network connection failure.
|
||||
warn "Discovery send failed", msg = e.msg, address = $ta
|
||||
|
||||
discv5_network_bytes.inc(data.len, labelValues = ["out"])
|
||||
|
||||
proc send*(d: Protocol, a: Address, data: seq[byte]) =
|
||||
asyncSpawn sendTo(d, a, data)
|
||||
|
||||
|
@ -422,6 +425,8 @@ proc sendWhoareyou(d: Protocol, toId: NodeId, a: Address,
|
|||
debug "Node with this id already has ongoing handshake, ignoring packet"
|
||||
|
||||
proc receive*(d: Protocol, a: Address, packet: openArray[byte]) =
|
||||
discv5_network_bytes.inc(packet.len, labelValues = ["in"])
|
||||
|
||||
let decoded = d.codec.decodePacket(a, packet)
|
||||
if decoded.isOk:
|
||||
let packet = decoded[]
|
||||
|
|
Loading…
Reference in New Issue