Enable trace timings logs for transaction factory (#4845)

* Enable trace timings logs for transaction factory.
This commit is contained in:
Marcio Diaz
2020-02-07 08:12:19 +01:00
committed by GitHub
parent 8c373916a4
commit 41644c2ae8
5 changed files with 30 additions and 16 deletions
+2
View File
@@ -3400,6 +3400,7 @@ dependencies = [
"sc-service",
"sc-service-test",
"sc-telemetry",
"sc-tracing",
"sc-transaction-pool",
"serde",
"sp-authority-discovery",
@@ -3417,6 +3418,7 @@ dependencies = [
"structopt",
"substrate-build-script-utils",
"tempfile",
"tracing",
"vergen",
"wasm-bindgen",
"wasm-bindgen-futures",
+2
View File
@@ -32,6 +32,7 @@ jsonrpc-core = "14.0.3"
log = "0.4.8"
rand = "0.7.2"
structopt = { version = "0.3.8", optional = true }
tracing = "0.1.10"
# primitives
sp-authority-discovery = { version = "2.0.0", path = "../../../primitives/authority-discovery" }
@@ -60,6 +61,7 @@ sc-offchain = { version = "2.0.0", path = "../../../client/offchain" }
sc-rpc = { version = "2.0.0", path = "../../../client/rpc" }
sc-basic-authorship = { version = "0.8", path = "../../../client/basic-authorship" }
sc-service = { version = "0.8", default-features = false, path = "../../../client/service" }
sc-tracing = { version = "2.0.0", path = "../../../client/tracing" }
sc-telemetry = { version = "2.0.0", path = "../../../client/telemetry" }
sc-authority-discovery = { version = "0.8", path = "../../../client/authority-discovery" }
+10
View File
@@ -56,6 +56,16 @@ where
_ => panic!("Factory is only supported for development and local testnet."),
}
// Setup tracing.
if let Some(tracing_targets) = cli_args.shared_params.tracing_targets.as_ref() {
let subscriber = sc_tracing::ProfilingSubscriber::new(
cli_args.shared_params.tracing_receiver.into(), tracing_targets
);
if let Err(e) = tracing::subscriber::set_global_default(subscriber) {
panic!("Unable to set global default subscriber {}", e);
}
}
let factory_state = FactoryState::new(
cli_args.mode.clone(),
cli_args.num,
+2 -2
View File
@@ -638,8 +638,8 @@ where
config.telemetry_endpoints = Some(TelemetryEndpoints::new(cli.telemetry_endpoints));
}
config.tracing_targets = cli.tracing_targets.into();
config.tracing_receiver = cli.tracing_receiver.into();
config.tracing_targets = cli.shared_params.tracing_targets.into();
config.tracing_receiver = cli.shared_params.tracing_receiver.into();
// Imply forced authoring on --dev
config.force_authoring = cli.shared_params.dev || cli.force_authoring;
+14 -14
View File
@@ -113,6 +113,20 @@ pub struct SharedParams {
/// Sets a custom logging filter.
#[structopt(short = "l", long = "log", value_name = "LOG_PATTERN")]
pub log: Option<String>,
/// Comma separated list of targets for tracing
#[structopt(long = "tracing-targets", value_name = "TARGETS")]
pub tracing_targets: Option<String>,
/// Receiver to process tracing messages
#[structopt(
long = "tracing-receiver",
value_name = "RECEIVER",
possible_values = &TracingReceiver::variants(),
case_insensitive = true,
default_value = "Log"
)]
pub tracing_receiver: TracingReceiver,
}
/// Parameters for block import.
@@ -579,20 +593,6 @@ pub struct RunCmd {
#[structopt(long = "force-authoring")]
pub force_authoring: bool,
/// Comma separated list of targets for tracing
#[structopt(long = "tracing-targets", value_name = "TARGETS")]
pub tracing_targets: Option<String>,
/// Receiver to process tracing messages
#[structopt(
long = "tracing-receiver",
value_name = "RECEIVER",
possible_values = &TracingReceiver::variants(),
case_insensitive = true,
default_value = "Log"
)]
pub tracing_receiver: TracingReceiver,
/// Specify custom keystore path.
#[structopt(long = "keystore-path", value_name = "PATH", parse(from_os_str))]
pub keystore_path: Option<PathBuf>,