Storage monitor added to polkadot node (#6619)

* Storage monitor added to polkadot node

Related to: https://github.com/paritytech/substrate/issues/12399

* Cargo.lock updated

* Cargo.lock update

* Revert "Cargo.lock update"

This reverts commit 04dfe5fe65ea7d1476d4632ad647f2c1c669ab1a.

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <info@kchr.de>

* missing_docs fixes

* Cargo.lock updated

---------

Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Michal Kucharczyk
2023-01-27 22:46:36 +01:00
committed by GitHub
parent af74f43413
commit c251912652
5 changed files with 20 additions and 4 deletions
+1
View File
@@ -6516,6 +6516,7 @@ dependencies = [
"sc-cli", "sc-cli",
"sc-executor", "sc-executor",
"sc-service", "sc-service",
"sc-storage-monitor",
"sc-sysinfo", "sc-sysinfo",
"sc-tracing", "sc-tracing",
"sp-core", "sp-core",
+1
View File
@@ -36,6 +36,7 @@ polkadot-node-metrics = { path = "../node/metrics" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-storage-monitor = { git = "https://github.com/paritytech/substrate", branch = "master" }
[build-dependencies] [build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
+4 -1
View File
@@ -86,7 +86,6 @@ pub struct ValidationWorkerCommand {
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[group(skip)] #[group(skip)]
pub struct RunCmd { pub struct RunCmd {
#[allow(missing_docs)]
#[clap(flatten)] #[clap(flatten)]
pub base: sc_cli::RunCmd, pub base: sc_cli::RunCmd,
@@ -151,6 +150,10 @@ pub struct RunCmd {
pub struct Cli { pub struct Cli {
#[command(subcommand)] #[command(subcommand)]
pub subcommand: Option<Subcommand>, pub subcommand: Option<Subcommand>,
#[clap(flatten)] #[clap(flatten)]
pub run: RunCmd, pub run: RunCmd,
#[clap(flatten)]
pub storage_monitor: sc_storage_monitor::StorageMonitorParams,
} }
+11 -3
View File
@@ -335,7 +335,8 @@ where
})) }))
.flatten(); .flatten();
service::build_full( let database_source = config.database.clone();
let task_manager = service::build_full(
config, config,
service::IsCollator::No, service::IsCollator::No,
grandpa_pause, grandpa_pause,
@@ -348,8 +349,15 @@ where
maybe_malus_finality_delay, maybe_malus_finality_delay,
hwbench, hwbench,
) )
.map(|full| full.task_manager) .map(|full| full.task_manager)?;
.map_err(Into::into)
sc_storage_monitor::StorageMonitorService::try_spawn(
cli.storage_monitor,
database_source,
&task_manager.spawn_essential_handle(),
)?;
Ok(task_manager)
}) })
} }
+3
View File
@@ -48,6 +48,9 @@ pub enum Error {
#[error("Command is not implemented")] #[error("Command is not implemented")]
CommandNotImplemented, CommandNotImplemented,
#[error(transparent)]
Storage(#[from] sc_storage_monitor::Error),
#[error("Other: {0}")] #[error("Other: {0}")]
Other(String), Other(String),
} }