mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
Per subsystem CPU usage tracking (#4239)
* SubsystemContext: add subsystem name str Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Overseer builder proc macro changes * initilize SubsystemContext name field. * Add subsystem name in TaskKind::launch_task() Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Update ToOverseer enum Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Assign subsystem names to orphan tasks Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * SubsystemContext: add subsystem name str Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Overseer builder proc macro changes * initilize SubsystemContext name field. * Add subsystem name in TaskKind::launch_task() Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Update ToOverseer enum Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Assign subsystem names to orphan tasks Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Rebase changes for new spawn() group param Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Add subsystem constat in JobTrait Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Add subsystem string Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix spawn() calls Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix more tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Address PR review feedback #1 Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Address PR review round 2 Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fixes - remove JobTrait::Subsystem - fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * update Cargo.lock Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -383,8 +383,9 @@ impl Error {
|
||||
fn trace(&self) {
|
||||
match self {
|
||||
// don't spam the log with spurious errors
|
||||
Self::RuntimeApi(_) | Self::Oneshot(_) =>
|
||||
tracing::debug!(target: LOG_TARGET, err = ?self),
|
||||
Self::RuntimeApi(_) | Self::Oneshot(_) => {
|
||||
tracing::debug!(target: LOG_TARGET, err = ?self)
|
||||
},
|
||||
// it's worth reporting otherwise
|
||||
_ => tracing::warn!(target: LOG_TARGET, err = ?self),
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ impl CandidateBackingJob {
|
||||
}
|
||||
};
|
||||
sender
|
||||
.send_command(FromJobCommand::Spawn("Backing Validation", bg.boxed()))
|
||||
.send_command(FromJobCommand::Spawn("backing-validation", bg.boxed()))
|
||||
.await?;
|
||||
}
|
||||
|
||||
@@ -900,11 +900,13 @@ impl CandidateBackingJob {
|
||||
.await;
|
||||
|
||||
match confirmation_rx.await {
|
||||
Err(oneshot::Canceled) =>
|
||||
tracing::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",),
|
||||
Err(oneshot::Canceled) => {
|
||||
tracing::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",)
|
||||
},
|
||||
Ok(ImportStatementsResult::ValidImport) => {},
|
||||
Ok(ImportStatementsResult::InvalidImport) =>
|
||||
tracing::warn!(target: LOG_TARGET, "Failed to import statements of validity",),
|
||||
Ok(ImportStatementsResult::InvalidImport) => {
|
||||
tracing::warn!(target: LOG_TARGET, "Failed to import statements of validity",)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1168,7 +1170,7 @@ impl util::JobTrait for CandidateBackingJob {
|
||||
type RunArgs = SyncCryptoStorePtr;
|
||||
type Metrics = Metrics;
|
||||
|
||||
const NAME: &'static str = "CandidateBackingJob";
|
||||
const NAME: &'static str = "candidate-backing-job";
|
||||
|
||||
fn run<S: SubsystemSender>(
|
||||
parent: Hash,
|
||||
|
||||
@@ -233,7 +233,7 @@ impl JobTrait for BitfieldSigningJob {
|
||||
type RunArgs = SyncCryptoStorePtr;
|
||||
type Metrics = Metrics;
|
||||
|
||||
const NAME: &'static str = "BitfieldSigningJob";
|
||||
const NAME: &'static str = "bitfield-signing-job";
|
||||
|
||||
/// Run a job for the parent block indicated
|
||||
fn run<S: SubsystemSender>(
|
||||
|
||||
@@ -148,7 +148,7 @@ impl JobTrait for ProvisioningJob {
|
||||
type RunArgs = ();
|
||||
type Metrics = Metrics;
|
||||
|
||||
const NAME: &'static str = "ProvisioningJob";
|
||||
const NAME: &'static str = "provisioner-job";
|
||||
|
||||
/// Run a job for the parent block indicated
|
||||
//
|
||||
|
||||
@@ -278,11 +278,21 @@ impl TaskExecutor {
|
||||
}
|
||||
|
||||
impl sp_core::traits::SpawnNamed for TaskExecutor {
|
||||
fn spawn_blocking(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) {
|
||||
fn spawn_blocking(
|
||||
&self,
|
||||
_task_name: &'static str,
|
||||
_subsystem_name: Option<&'static str>,
|
||||
future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
self.0.spawn_ok(future);
|
||||
}
|
||||
|
||||
fn spawn(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) {
|
||||
fn spawn(
|
||||
&self,
|
||||
_task_name: &'static str,
|
||||
_subsystem_name: Option<&'static str>,
|
||||
future: futures::future::BoxFuture<'static, ()>,
|
||||
) {
|
||||
self.0.spawn_ok(future);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,8 @@ where
|
||||
)
|
||||
}
|
||||
} else {
|
||||
self.spawn_handle.spawn_blocking(API_REQUEST_TASK_NAME, request);
|
||||
self.spawn_handle
|
||||
.spawn_blocking(API_REQUEST_TASK_NAME, Some("runtime-api"), request);
|
||||
self.active_requests.push(receiver);
|
||||
}
|
||||
}
|
||||
@@ -288,7 +289,8 @@ where
|
||||
}
|
||||
|
||||
if let Some((req, recv)) = self.waiting_requests.pop_front() {
|
||||
self.spawn_handle.spawn_blocking(API_REQUEST_TASK_NAME, req);
|
||||
self.spawn_handle
|
||||
.spawn_blocking(API_REQUEST_TASK_NAME, Some("runtime-api"), req);
|
||||
self.active_requests.push(recv);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user