mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-24 20:47:17 +00:00
Reduce network debug noise (#2593)
The identify network debug logs can get quite noisy and are unnecessary to print on every request/response. This PR reduces debug noise by only printing messages for identify messages that offer some new information.
This commit is contained in:
parent
4755d4b236
commit
95b17137a8
@ -1004,14 +1004,6 @@ impl<TSpec: EthSpec> NetworkBehaviourEventProcess<IdentifyEvent> for Behaviour<T
|
|||||||
}
|
}
|
||||||
// send peer info to the peer manager.
|
// send peer info to the peer manager.
|
||||||
self.peer_manager.identify(&peer_id, &info);
|
self.peer_manager.identify(&peer_id, &info);
|
||||||
|
|
||||||
debug!(self.log, "Identified Peer"; "peer" => %peer_id,
|
|
||||||
"protocol_version" => info.protocol_version,
|
|
||||||
"agent_version" => info.agent_version,
|
|
||||||
"listening_ addresses" => ?info.listen_addrs,
|
|
||||||
"observed_address" => ?info.observed_addr,
|
|
||||||
"protocols" => ?info.protocols
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
IdentifyEvent::Sent { .. } => {}
|
IdentifyEvent::Sent { .. } => {}
|
||||||
IdentifyEvent::Error { .. } => {}
|
IdentifyEvent::Error { .. } => {}
|
||||||
|
@ -483,10 +483,23 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
|||||||
pub fn identify(&mut self, peer_id: &PeerId, info: &IdentifyInfo) {
|
pub fn identify(&mut self, peer_id: &PeerId, info: &IdentifyInfo) {
|
||||||
if let Some(peer_info) = self.network_globals.peers.write().peer_info_mut(peer_id) {
|
if let Some(peer_info) = self.network_globals.peers.write().peer_info_mut(peer_id) {
|
||||||
let previous_kind = peer_info.client.kind.clone();
|
let previous_kind = peer_info.client.kind.clone();
|
||||||
|
let previous_listening_addresses = std::mem::replace(
|
||||||
|
&mut peer_info.listening_addresses,
|
||||||
|
info.listen_addrs.clone(),
|
||||||
|
);
|
||||||
peer_info.client = client::Client::from_identify_info(info);
|
peer_info.client = client::Client::from_identify_info(info);
|
||||||
peer_info.listening_addresses = info.listen_addrs.clone();
|
|
||||||
|
|
||||||
if previous_kind != peer_info.client.kind {
|
if previous_kind != peer_info.client.kind
|
||||||
|
|| peer_info.listening_addresses != previous_listening_addresses
|
||||||
|
{
|
||||||
|
debug!(self.log, "Identified Peer"; "peer" => %peer_id,
|
||||||
|
"protocol_version" => &info.protocol_version,
|
||||||
|
"agent_version" => &info.agent_version,
|
||||||
|
"listening_ addresses" => ?info.listen_addrs,
|
||||||
|
"observed_address" => ?info.observed_addr,
|
||||||
|
"protocols" => ?info.protocols
|
||||||
|
);
|
||||||
|
|
||||||
// update the peer client kind metric
|
// update the peer client kind metric
|
||||||
if let Some(v) = metrics::get_int_gauge(
|
if let Some(v) = metrics::get_int_gauge(
|
||||||
&metrics::PEERS_PER_CLIENT,
|
&metrics::PEERS_PER_CLIENT,
|
||||||
|
Loading…
Reference in New Issue
Block a user