Skip to content

p2p: Improve observalibility of channel sending/receiving #3666

@brapse

Description

@brapse

Each Peer has an MConnection which multiplexes reactor channel communication. For debugging the progress of the various subsystems it would be helpful to monitor when each channel last sent/received messages.

The peer currently exposes sending/receiving telemetry but it doesn't include a Channel specific label.
Receiving:

tendermint/p2p/peer.go

Lines 249 to 253 in 4253e67

res := p.mconn.Send(chID, msgBytes)
if res {
p.metrics.PeerSendBytesTotal.With("peer_id", string(p.ID())).Add(float64(len(msgBytes)))
}
return res

Sending:

tendermint/p2p/peer.go

Lines 365 to 373 in 4253e67

onReceive := func(chID byte, msgBytes []byte) {
reactor := reactorsByCh[chID]
if reactor == nil {
// Note that its ok to panic here as it's caught in the conn._recover,
// which does onPeerError.
panic(fmt.Sprintf("Unknown channel %X", chID))
}
p.metrics.PeerReceiveBytesTotal.With("peer_id", string(p.ID())).Add(float64(len(msgBytes)))
reactor.Receive(chID, p, msgBytes)

The goal then is to add a label to these metrics to allow channel specific observations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions