diff options
Diffstat (limited to 'p2p/protocols/protocol.go')
-rw-r--r-- | p2p/protocols/protocol.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/p2p/protocols/protocol.go b/p2p/protocols/protocol.go index 9914c9958..849a7ef39 100644 --- a/p2p/protocols/protocol.go +++ b/p2p/protocols/protocol.go @@ -33,7 +33,9 @@ import ( "fmt" "reflect" "sync" + "time" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p" ) @@ -217,6 +219,8 @@ func (p *Peer) Drop(err error) { // this low level call will be wrapped by libraries providing routed or broadcast sends // but often just used to forward and push messages to directly connected peers func (p *Peer) Send(msg interface{}) error { + defer metrics.GetOrRegisterResettingTimer("peer.send_t", nil).UpdateSince(time.Now()) + metrics.GetOrRegisterCounter("peer.send", nil).Inc(1) code, found := p.spec.GetCode(msg) if !found { return errorf(ErrInvalidMsgType, "%v", code) |