Skip to content

Commit

Permalink
Logging: Display the number of TCP/QUIC connected peers.
Browse files Browse the repository at this point in the history
  • Loading branch information
nalepae committed Apr 2, 2024
1 parent 649e2ea commit c3ccf8d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions beacon-chain/p2p/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,19 @@ func (s *Service) Start() {
async.RunEvery(s.ctx, time.Duration(params.BeaconConfig().RespTimeout)*time.Second, s.updateMetrics)
async.RunEvery(s.ctx, refreshRate, s.RefreshENR)
async.RunEvery(s.ctx, 1*time.Minute, func() {
inboundQUICCount := len(s.peers.InboundConnectedQUIC())
inboundTCPCount := len(s.peers.InboundConnectedTCP())
outboundQUICCount := len(s.peers.OutboundConnectedQUIC())
outboundTCPCount := len(s.peers.OutboundConnectedTCP())
total := inboundQUICCount + inboundTCPCount + outboundQUICCount + outboundTCPCount

log.WithFields(logrus.Fields{
"inbound": len(s.peers.InboundConnected()),
"outbound": len(s.peers.OutboundConnected()),
"activePeers": len(s.peers.Active()),
}).Info("Peer summary")
"inboundQUIC": inboundQUICCount,
"inboundTCP": inboundTCPCount,
"outboundQUIC": outboundQUICCount,
"outboundTCP": outboundTCPCount,
"total": total,
}).Info("Connected peers")
})

multiAddrs := s.host.Network().ListenAddresses()
Expand Down

0 comments on commit c3ccf8d

Please sign in to comment.