From 97acf7bc969075b3cc622c27020cdc607e265c20 Mon Sep 17 00:00:00 2001 From: gilescope Date: Fri, 4 Jun 2021 16:22:59 +0100 Subject: [PATCH] Stop sending network_state to telemetry (We send network information to prometheus) --- client/service/src/metrics.rs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/client/service/src/metrics.rs b/client/service/src/metrics.rs index 516fb243557cf..8fc48ccf8c863 100644 --- a/client/service/src/metrics.rs +++ b/client/service/src/metrics.rs @@ -27,7 +27,7 @@ use sp_runtime::traits::{NumberFor, Block, SaturatedConversion, UniqueSaturatedI use sp_transaction_pool::{PoolStatus, MaintainedTransactionPool}; use sp_utils::metrics::register_globals; use sc_client_api::{ClientInfo, UsageProvider}; -use sc_network::{config::Role, NetworkStatus, NetworkService, network_state::NetworkState}; +use sc_network::{config::Role, NetworkStatus, NetworkService}; use std::sync::Arc; use std::time::Duration; use wasm_timer::Instant; @@ -171,30 +171,18 @@ impl MetricsService { let mut timer = Delay::new(Duration::from_secs(0)); let timer_interval = Duration::from_secs(5); - let net_state_duration = Duration::from_secs(30); - let mut last_net_state = Instant::now(); - loop { // Wait for the next tick of the timer. (&mut timer).await; - let now = Instant::now(); - let from_net_state = now.duration_since(last_net_state); // Try to get the latest network information. let net_status = network.status().await.ok(); - let net_state = if from_net_state >= net_state_duration { - last_net_state = now; - network.network_state().await.ok() - } else { - None - }; // Update / Send the metrics. self.update( &client.usage_info(), &transactions.status(), net_status, - net_state, ); // Schedule next tick. @@ -207,7 +195,6 @@ impl MetricsService { info: &ClientInfo, txpool_status: &PoolStatus, net_status: Option>, - net_state: Option, ) { let now = Instant::now(); let elapsed = (now - self.last_update).as_secs(); @@ -300,15 +287,5 @@ impl MetricsService { } } } - - // Send network state information, if any. - if let Some(net_state) = net_state { - telemetry!( - self.telemetry; - SUBSTRATE_INFO; - "system.network_state"; - "state" => net_state, - ); - } } }