p2p: measure packet throughput too, not just bandwidth

release/1.9
Péter Szilágyi 4 years ago
parent dce533c246
commit 42ccb2fdbd
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
  1. 1
      p2p/peer.go
  2. 1
      p2p/rlpx.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:

@ -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)

Loading…
Cancel
Save