mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Telemetry per node (#7463)
This commit is contained in:
@@ -11,6 +11,7 @@ pub use sc_executor::NativeExecutor;
|
||||
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||
use sc_finality_grandpa::SharedVoterState;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_telemetry::TelemetrySpan;
|
||||
|
||||
// Our native executor instance.
|
||||
native_executor_instance!(
|
||||
@@ -35,7 +36,8 @@ pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponen
|
||||
sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>,
|
||||
AuraPair
|
||||
>,
|
||||
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>
|
||||
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
|
||||
Option<TelemetrySpan>,
|
||||
)
|
||||
>, ServiceError> {
|
||||
if config.keystore_remote.is_some() {
|
||||
@@ -44,7 +46,7 @@ pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponen
|
||||
}
|
||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
let (client, backend, keystore_container, task_manager, telemetry_span) =
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -77,9 +79,15 @@ pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponen
|
||||
)?;
|
||||
|
||||
Ok(sc_service::PartialComponents {
|
||||
client, backend, task_manager, import_queue, keystore_container,
|
||||
select_chain, transaction_pool,inherent_data_providers,
|
||||
other: (aura_block_import, grandpa_link),
|
||||
client,
|
||||
backend,
|
||||
task_manager,
|
||||
import_queue,
|
||||
keystore_container,
|
||||
select_chain,
|
||||
transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (aura_block_import, grandpa_link, telemetry_span),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -93,9 +101,15 @@ fn remote_keystore(_url: &String) -> Result<Arc<LocalKeystore>, &'static str> {
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
let sc_service::PartialComponents {
|
||||
client, backend, mut task_manager, import_queue, mut keystore_container,
|
||||
select_chain, transaction_pool, inherent_data_providers,
|
||||
other: (block_import, grandpa_link),
|
||||
client,
|
||||
backend,
|
||||
mut task_manager,
|
||||
import_queue,
|
||||
mut keystore_container,
|
||||
select_chain,
|
||||
transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (block_import, grandpa_link, telemetry_span),
|
||||
} = new_partial(&config)?;
|
||||
|
||||
if let Some(url) = &config.keystore_remote {
|
||||
@@ -133,7 +147,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
let name = config.network.node_name.clone();
|
||||
let enable_grandpa = !config.disable_grandpa;
|
||||
let prometheus_registry = config.prometheus_registry().cloned();
|
||||
let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
let client = client.clone();
|
||||
@@ -150,18 +163,23 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
})
|
||||
};
|
||||
|
||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
network: network.clone(),
|
||||
client: client.clone(),
|
||||
keystore: keystore_container.sync_keystore(),
|
||||
task_manager: &mut task_manager,
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
|
||||
rpc_extensions_builder,
|
||||
on_demand: None,
|
||||
remote_blockchain: None,
|
||||
backend, network_status_sinks, system_rpc_tx, config,
|
||||
})?;
|
||||
let (_rpc_handlers, telemetry_connection_notifier) = sc_service::spawn_tasks(
|
||||
sc_service::SpawnTasksParams {
|
||||
network: network.clone(),
|
||||
client: client.clone(),
|
||||
keystore: keystore_container.sync_keystore(),
|
||||
task_manager: &mut task_manager,
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
rpc_extensions_builder,
|
||||
on_demand: None,
|
||||
remote_blockchain: None,
|
||||
backend,
|
||||
network_status_sinks,
|
||||
system_rpc_tx,
|
||||
config,
|
||||
telemetry_span,
|
||||
},
|
||||
)?;
|
||||
|
||||
if role.is_authority() {
|
||||
let proposer = sc_basic_authorship::ProposerFactory::new(
|
||||
@@ -222,7 +240,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
config: grandpa_config,
|
||||
link: grandpa_link,
|
||||
network,
|
||||
telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
|
||||
telemetry_on_connect: telemetry_connection_notifier.map(|x| x.on_connect_stream()),
|
||||
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
|
||||
prometheus_registry,
|
||||
shared_voter_state: SharedVoterState::empty(),
|
||||
@@ -242,7 +260,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
|
||||
/// Builds a new service for a light client.
|
||||
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
let (client, backend, keystore_container, mut task_manager, on_demand) =
|
||||
let (client, backend, keystore_container, mut task_manager, on_demand, telemetry_span) =
|
||||
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
|
||||
|
||||
config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
|
||||
@@ -302,7 +320,6 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
task_manager: &mut task_manager,
|
||||
on_demand: Some(on_demand),
|
||||
rpc_extensions_builder: Box::new(|_, _| ()),
|
||||
telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
|
||||
config,
|
||||
client,
|
||||
keystore: keystore_container.sync_keystore(),
|
||||
@@ -310,9 +327,10 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
network,
|
||||
network_status_sinks,
|
||||
system_rpc_tx,
|
||||
})?;
|
||||
telemetry_span,
|
||||
})?;
|
||||
|
||||
network_starter.start_network();
|
||||
network_starter.start_network();
|
||||
|
||||
Ok(task_manager)
|
||||
Ok(task_manager)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user