Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Storage monitor added to polkadot node #6619

Merged
merged 11 commits into from
Jan 27, 2023
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ polkadot-node-metrics = { path = "../node/metrics" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-sysinfo = { 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]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
5 changes: 4 additions & 1 deletion cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ pub struct ValidationWorkerCommand {
#[derive(Debug, Parser)]
#[group(skip)]
pub struct RunCmd {
#[allow(missing_docs)]
#[clap(flatten)]
pub base: sc_cli::RunCmd,

Expand Down Expand Up @@ -151,6 +150,10 @@ pub struct RunCmd {
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<Subcommand>,

#[clap(flatten)]
pub run: RunCmd,

#[clap(flatten)]
pub storage_monitor: sc_storage_monitor::StorageMonitorParams,
}
14 changes: 11 additions & 3 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ where
}))
.flatten();

service::build_full(
let database_source = config.database.clone();
let task_manager = service::build_full(
config,
service::IsCollator::No,
grandpa_pause,
Expand All @@ -348,8 +349,15 @@ where
maybe_malus_finality_delay,
hwbench,
)
.map(|full| full.task_manager)
.map_err(Into::into)
.map(|full| full.task_manager)?;

sc_storage_monitor::StorageMonitorService::try_spawn(
cli.storage_monitor,
database_source,
&task_manager.spawn_essential_handle(),
)?;

Ok(task_manager)
})
}

Expand Down
3 changes: 3 additions & 0 deletions cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ pub enum Error {
#[error("Command is not implemented")]
CommandNotImplemented,

#[error(transparent)]
Storage(#[from] sc_storage_monitor::Error),

#[error("Other: {0}")]
Other(String),
}