mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Add group name in task metrics (#10196)
* SpawnNamed: add new trait methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Implement new methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * SpawnNamed: add new trait methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Implement new methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * New approach - spaw() group param Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update traits: SpawnNamed and SpawnNamed Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update TaskManager tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update test TaskExecutor Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix typo Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * grunt work: fix spawn() calls Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * remove old code Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt - the right version Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Implement review feedback - use Option group name in SpawnNamed methods - switch to kebab case - implement default group name - add group name to some tasks Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
@@ -424,6 +424,7 @@ where
|
||||
if let Some(offchain) = offchain_workers.clone() {
|
||||
spawn_handle.spawn(
|
||||
"offchain-notifications",
|
||||
Some("offchain-worker"),
|
||||
sc_offchain::notification_future(
|
||||
config.role.is_authority(),
|
||||
client.clone(),
|
||||
@@ -505,11 +506,13 @@ where
|
||||
// Inform the tx pool about imported and finalized blocks.
|
||||
spawn_handle.spawn(
|
||||
"txpool-notifications",
|
||||
Some("transaction-pool"),
|
||||
sc_transaction_pool::notification_future(client.clone(), transaction_pool.clone()),
|
||||
);
|
||||
|
||||
spawn_handle.spawn(
|
||||
"on-transaction-imported",
|
||||
Some("transaction-pool"),
|
||||
transaction_notifications(transaction_pool.clone(), network.clone(), telemetry.clone()),
|
||||
);
|
||||
|
||||
@@ -520,6 +523,7 @@ where
|
||||
let metrics = MetricsService::with_prometheus(telemetry.clone(), ®istry, &config)?;
|
||||
spawn_handle.spawn(
|
||||
"prometheus-endpoint",
|
||||
None,
|
||||
prometheus_endpoint::init_prometheus(port, registry).map(drop),
|
||||
);
|
||||
|
||||
@@ -531,6 +535,7 @@ where
|
||||
// Periodically updated metrics and telemetry updates.
|
||||
spawn_handle.spawn(
|
||||
"telemetry-periodic-send",
|
||||
None,
|
||||
metrics_service.run(client.clone(), transaction_pool.clone(), network.clone()),
|
||||
);
|
||||
|
||||
@@ -567,6 +572,7 @@ where
|
||||
// Spawn informant task
|
||||
spawn_handle.spawn(
|
||||
"informant",
|
||||
None,
|
||||
sc_informant::build(
|
||||
client.clone(),
|
||||
network.clone(),
|
||||
@@ -798,7 +804,7 @@ where
|
||||
config.network.default_peers_set.in_peers as usize +
|
||||
config.network.default_peers_set.out_peers as usize,
|
||||
);
|
||||
spawn_handle.spawn("block_request_handler", handler.run());
|
||||
spawn_handle.spawn("block-request-handler", Some("networking"), handler.run());
|
||||
protocol_config
|
||||
}
|
||||
};
|
||||
@@ -815,7 +821,7 @@ where
|
||||
config.network.default_peers_set.in_peers as usize +
|
||||
config.network.default_peers_set.out_peers as usize,
|
||||
);
|
||||
spawn_handle.spawn("state_request_handler", handler.run());
|
||||
spawn_handle.spawn("state-request-handler", Some("networking"), handler.run());
|
||||
protocol_config
|
||||
}
|
||||
};
|
||||
@@ -828,7 +834,7 @@ where
|
||||
// Allow both outgoing and incoming requests.
|
||||
let (handler, protocol_config) =
|
||||
WarpSyncRequestHandler::new(protocol_id.clone(), provider.clone());
|
||||
spawn_handle.spawn("warp_sync_request_handler", handler.run());
|
||||
spawn_handle.spawn("warp-sync-request-handler", Some("networking"), handler.run());
|
||||
protocol_config
|
||||
};
|
||||
(provider, protocol_config)
|
||||
@@ -842,7 +848,7 @@ where
|
||||
// Allow both outgoing and incoming requests.
|
||||
let (handler, protocol_config) =
|
||||
LightClientRequestHandler::new(&protocol_id, client.clone());
|
||||
spawn_handle.spawn("light_client_request_handler", handler.run());
|
||||
spawn_handle.spawn("light-client-request-handler", Some("networking"), handler.run());
|
||||
protocol_config
|
||||
}
|
||||
};
|
||||
@@ -852,13 +858,13 @@ where
|
||||
executor: {
|
||||
let spawn_handle = Clone::clone(&spawn_handle);
|
||||
Some(Box::new(move |fut| {
|
||||
spawn_handle.spawn("libp2p-node", fut);
|
||||
spawn_handle.spawn("libp2p-node", Some("networking"), fut);
|
||||
}))
|
||||
},
|
||||
transactions_handler_executor: {
|
||||
let spawn_handle = Clone::clone(&spawn_handle);
|
||||
Box::new(move |fut| {
|
||||
spawn_handle.spawn("network-transactions-handler", fut);
|
||||
spawn_handle.spawn("network-transactions-handler", Some("networking"), fut);
|
||||
})
|
||||
},
|
||||
network_config: config.network.clone(),
|
||||
@@ -920,7 +926,7 @@ where
|
||||
// issue, and ideally we would like to fix the network future to take as little time as
|
||||
// possible, but we also take the extra harm-prevention measure to execute the networking
|
||||
// future using `spawn_blocking`.
|
||||
spawn_handle.spawn_blocking("network-worker", async move {
|
||||
spawn_handle.spawn_blocking("network-worker", Some("networking"), async move {
|
||||
if network_start_rx.await.is_err() {
|
||||
log::warn!(
|
||||
"The NetworkStart returned as part of `build_network` has been silently dropped"
|
||||
|
||||
Reference in New Issue
Block a user