From 42ccb2fdbda72b9ed9fa0fbb5594ee706fb8008c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 24 Jun 2020 09:36:20 +0300 Subject: [PATCH] p2p: measure packet throughput too, not just bandwidth --- p2p/peer.go | 1 + p2p/rlpx.go | 1 + 2 files changed, 2 insertions(+) diff --git a/p2p/peer.go b/p2p/peer.go index 52a777cd1..54fb653e2 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -304,6 +304,7 @@ func (p *Peer) handle(msg Msg) error { if metrics.Enabled { m := fmt.Sprintf("%s/%s/%d/%#02x", ingressMeterName, proto.Name, proto.Version, msg.Code-proto.offset) metrics.GetOrRegisterMeter(m, nil).Mark(int64(msg.meterSize)) + metrics.GetOrRegisterMeter(m+"/packets", nil).Mark(1) } select { case proto.in <- msg: diff --git a/p2p/rlpx.go b/p2p/rlpx.go index c134aec1d..4d903a08a 100644 --- a/p2p/rlpx.go +++ b/p2p/rlpx.go @@ -597,6 +597,7 @@ func (rw *rlpxFrameRW) WriteMsg(msg Msg) error { if metrics.Enabled && msg.meterCap.Name != "" { // don't meter non-subprotocol messages m := fmt.Sprintf("%s/%s/%d/%#02x", egressMeterName, msg.meterCap.Name, msg.meterCap.Version, msg.meterCode) metrics.GetOrRegisterMeter(m, nil).Mark(int64(msg.meterSize)) + metrics.GetOrRegisterMeter(m+"/packets", nil).Mark(1) } // write header headbuf := make([]byte, 32)