mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 07:05:44 +00:00
Disable log reloading by default (#9966)
* Disable log reloading by default
This disables the log reloading that was enabled by default. The problem
is that the log reload implementation of `tracing` is using a lock to
make the layer replaceable. This lock needs to be locked every time we
need to check if a particular target is enabled (assuming the log level
is high enough). This kills the performance when for example
`sometarget=trace` logging is enabled.
* 🤦
* Remove unused parameter
* Fix test
* Fix
This commit is contained in:
@@ -99,7 +99,6 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
|
|||||||
base_path: Some(base_path),
|
base_path: Some(base_path),
|
||||||
informant_output_format: Default::default(),
|
informant_output_format: Default::default(),
|
||||||
wasm_runtime_overrides: None,
|
wasm_runtime_overrides: None,
|
||||||
disable_log_reloading: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
node_cli::service::new_full_base(config, |_, _| ()).expect("Creates node")
|
node_cli::service::new_full_base(config, |_, _| ()).expect("Creates node")
|
||||||
|
|||||||
@@ -522,7 +522,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
|
|||||||
dev_key_seed: self.dev_key_seed(is_dev)?,
|
dev_key_seed: self.dev_key_seed(is_dev)?,
|
||||||
tracing_targets: self.tracing_targets()?,
|
tracing_targets: self.tracing_targets()?,
|
||||||
tracing_receiver: self.tracing_receiver()?,
|
tracing_receiver: self.tracing_receiver()?,
|
||||||
disable_log_reloading: self.is_log_filter_reloading_disabled()?,
|
|
||||||
chain_spec,
|
chain_spec,
|
||||||
max_runtime_instances,
|
max_runtime_instances,
|
||||||
announce_block: self.announce_block()?,
|
announce_block: self.announce_block()?,
|
||||||
@@ -542,9 +541,9 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
|
|||||||
Ok(self.shared_params().log_filters().join(","))
|
Ok(self.shared_params().log_filters().join(","))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is log reloading disabled (enabled by default)
|
/// Is log reloading enabled?
|
||||||
fn is_log_filter_reloading_disabled(&self) -> Result<bool> {
|
fn enable_log_reloading(&self) -> Result<bool> {
|
||||||
Ok(self.shared_params().is_log_filter_reloading_disabled())
|
Ok(self.shared_params().enable_log_reloading())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Should the log color output be disabled?
|
/// Should the log color output be disabled?
|
||||||
@@ -563,7 +562,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
|
|||||||
sp_panic_handler::set(&C::support_url(), &C::impl_version());
|
sp_panic_handler::set(&C::support_url(), &C::impl_version());
|
||||||
|
|
||||||
let mut logger = LoggerBuilder::new(self.log_filters()?);
|
let mut logger = LoggerBuilder::new(self.log_filters()?);
|
||||||
logger.with_log_reloading(!self.is_log_filter_reloading_disabled()?);
|
logger.with_log_reloading(self.enable_log_reloading()?);
|
||||||
|
|
||||||
if let Some(tracing_targets) = self.tracing_targets()? {
|
if let Some(tracing_targets) = self.tracing_targets()? {
|
||||||
let tracing_receiver = self.tracing_receiver()?;
|
let tracing_receiver = self.tracing_receiver()?;
|
||||||
|
|||||||
@@ -50,13 +50,15 @@ pub struct SharedParams {
|
|||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
pub disable_log_color: bool,
|
pub disable_log_color: bool,
|
||||||
|
|
||||||
/// Disable feature to dynamically update and reload the log filter.
|
/// Enable feature to dynamically update and reload the log filter.
|
||||||
|
///
|
||||||
|
/// Be aware that enabling this feature can lead to a performance decrease up to factor six or
|
||||||
|
/// more. Depending on the global logging level the performance decrease changes.
|
||||||
///
|
///
|
||||||
/// By default this feature is enabled, however it leads to a small performance decrease.
|
|
||||||
/// The `system_addLogFilter` and `system_resetLogFilter` RPCs will have no effect with this
|
/// The `system_addLogFilter` and `system_resetLogFilter` RPCs will have no effect with this
|
||||||
/// option set.
|
/// option not being set.
|
||||||
#[structopt(long = "disable-log-reloading")]
|
#[structopt(long)]
|
||||||
pub disable_log_reloading: bool,
|
pub enable_log_reloading: bool,
|
||||||
|
|
||||||
/// Sets a custom profiling filter. Syntax is the same as for logging: <target>=<level>
|
/// Sets a custom profiling filter. Syntax is the same as for logging: <target>=<level>
|
||||||
#[structopt(long = "tracing-targets", value_name = "TARGETS")]
|
#[structopt(long = "tracing-targets", value_name = "TARGETS")]
|
||||||
@@ -107,9 +109,9 @@ impl SharedParams {
|
|||||||
self.disable_log_color
|
self.disable_log_color
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is log reloading disabled
|
/// Is log reloading enabled
|
||||||
pub fn is_log_filter_reloading_disabled(&self) -> bool {
|
pub fn enable_log_reloading(&self) -> bool {
|
||||||
self.disable_log_reloading
|
self.enable_log_reloading
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Receiver to process tracing messages.
|
/// Receiver to process tracing messages.
|
||||||
|
|||||||
@@ -308,7 +308,10 @@ fn test_add_reset_log_filter() {
|
|||||||
|
|
||||||
// Enter log generation / filter reload
|
// Enter log generation / filter reload
|
||||||
if std::env::var("TEST_LOG_FILTER").is_ok() {
|
if std::env::var("TEST_LOG_FILTER").is_ok() {
|
||||||
sc_tracing::logging::LoggerBuilder::new("test_before_add=debug").init().unwrap();
|
let mut builder = sc_tracing::logging::LoggerBuilder::new("test_before_add=debug");
|
||||||
|
builder.with_log_reloading(true);
|
||||||
|
builder.init().unwrap();
|
||||||
|
|
||||||
for line in std::io::stdin().lock().lines() {
|
for line in std::io::stdin().lock().lines() {
|
||||||
let line = line.expect("Failed to read bytes");
|
let line = line.expect("Failed to read bytes");
|
||||||
if line.contains("add_reload") {
|
if line.contains("add_reload") {
|
||||||
|
|||||||
@@ -118,8 +118,6 @@ pub struct Configuration {
|
|||||||
pub dev_key_seed: Option<String>,
|
pub dev_key_seed: Option<String>,
|
||||||
/// Tracing targets
|
/// Tracing targets
|
||||||
pub tracing_targets: Option<String>,
|
pub tracing_targets: Option<String>,
|
||||||
/// Is log filter reloading disabled
|
|
||||||
pub disable_log_reloading: bool,
|
|
||||||
/// Tracing receiver
|
/// Tracing receiver
|
||||||
pub tracing_receiver: sc_tracing::TracingReceiver,
|
pub tracing_receiver: sc_tracing::TracingReceiver,
|
||||||
/// The size of the instances cache.
|
/// The size of the instances cache.
|
||||||
|
|||||||
@@ -274,7 +274,6 @@ fn node_config<
|
|||||||
announce_block: true,
|
announce_block: true,
|
||||||
base_path: Some(BasePath::new(root)),
|
base_path: Some(BasePath::new(root)),
|
||||||
informant_output_format: Default::default(),
|
informant_output_format: Default::default(),
|
||||||
disable_log_reloading: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ impl LoggerBuilder {
|
|||||||
Self {
|
Self {
|
||||||
directives: directives.into(),
|
directives: directives.into(),
|
||||||
profiling: None,
|
profiling: None,
|
||||||
log_reloading: true,
|
log_reloading: false,
|
||||||
force_colors: None,
|
force_colors: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ pub fn default_config(tokio_handle: Handle, mut chain_spec: Box<dyn ChainSpec>)
|
|||||||
base_path: Some(base_path),
|
base_path: Some(base_path),
|
||||||
wasm_runtime_overrides: None,
|
wasm_runtime_overrides: None,
|
||||||
informant_output_format,
|
informant_output_format,
|
||||||
disable_log_reloading: false,
|
|
||||||
keystore_remote: None,
|
keystore_remote: None,
|
||||||
keep_blocks: KeepBlocks::All,
|
keep_blocks: KeepBlocks::All,
|
||||||
state_pruning: Default::default(),
|
state_pruning: Default::default(),
|
||||||
|
|||||||
Reference in New Issue
Block a user