Skip to content

Commit

Permalink
chore(node): disable metrics record
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi authored and joshuef committed Feb 9, 2024
1 parent a3aceee commit 2086278
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
1 change: 1 addition & 0 deletions sn_networking/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ pub struct SwarmDriver {
pub(crate) close_group: Vec<PeerId>,
pub(crate) replication_fetcher: ReplicationFetcher,
#[cfg(feature = "open-metrics")]
#[allow(unused)]
pub(crate) network_metrics: NetworkMetrics,

cmd_receiver: mpsc::Receiver<SwarmCmd>,
Expand Down
14 changes: 1 addition & 13 deletions sn_networking/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ use custom_debug::Debug as CustomDebug;
use itertools::Itertools;
#[cfg(feature = "local-discovery")]
use libp2p::mdns;
#[cfg(feature = "open-metrics")]
use libp2p::metrics::Recorder;
use libp2p::{
kad::{self, GetClosestPeersError, InboundRequest, QueryResult, Record, RecordKey, K_VALUE},
multiaddr::Protocol,
Expand Down Expand Up @@ -184,10 +182,6 @@ impl Debug for NetworkEvent {
impl SwarmDriver {
/// Handle `SwarmEvents`
pub(super) fn handle_swarm_events(&mut self, event: SwarmEvent<NodeEvent>) -> Result<()> {
// This does not record all the events. `SwarmEvent::Behaviour(_)` are skipped. Hence `.record()` has to be
// called individually on each behaviour.
#[cfg(feature = "open-metrics")]
self.network_metrics.record(&event);
let start = Instant::now();
let event_string;
match event {
Expand All @@ -204,9 +198,7 @@ impl SwarmDriver {
// Handle the Identify event from the libp2p swarm.
SwarmEvent::Behaviour(NodeEvent::Identify(iden)) => {
event_string = "identify";
// Record the Identify event for metrics if the feature is enabled.
#[cfg(feature = "open-metrics")]
self.network_metrics.record(&(*iden));

// Match on the Identify event.
match *iden {
// If the event is a Received event, handle the received peer information.
Expand Down Expand Up @@ -338,8 +330,6 @@ impl SwarmDriver {
SwarmEvent::Behaviour(NodeEvent::Gossipsub(event)) => {
event_string = "gossip";

#[cfg(feature = "open-metrics")]
self.network_metrics.record(&*event);
if self.is_gossip_handler {
match *event {
libp2p::gossipsub::Event::Message {
Expand Down Expand Up @@ -669,8 +659,6 @@ impl SwarmDriver {
}

fn handle_kad_event(&mut self, kad_event: kad::Event) -> Result<()> {
#[cfg(feature = "open-metrics")]
self.network_metrics.record(&kad_event);
let start = Instant::now();
let event_string;

Expand Down

0 comments on commit 2086278

Please sign in to comment.