Skip to content

Commit

Permalink
refactor: minor modification for initialization of tracing options
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed May 12, 2024
1 parent a9e3509 commit abbc463
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
11 changes: 4 additions & 7 deletions src/cmd/src/datanode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use async_trait::async_trait;
use catalog::kvbackend::MetaKvBackend;
use clap::Parser;
use common_telemetry::info;
#[cfg(feature = "tokio-console")]
use common_telemetry::logging::TracingOptions;
use common_wal::config::DatanodeWalConfig;
use datanode::config::DatanodeOptions;
Expand Down Expand Up @@ -148,12 +147,10 @@ impl StartCommand {
opts.logging.level.clone_from(&global_options.log_level);
}

#[cfg(feature = "tokio-console")]
if global_options.tokio_console_addr.is_some() {
opts.tracing = TracingOptions {
tokio_console_addr: global_options.tokio_console_addr.clone(),
};
}
opts.tracing = TracingOptions {
#[cfg(feature = "tokio-console")]
tokio_console_addr: global_options.tokio_console_addr.clone(),
};

if let Some(addr) = &self.rpc_addr {
opts.rpc_addr.clone_from(addr);
Expand Down
11 changes: 4 additions & 7 deletions src/cmd/src/frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use client::client_manager::DatanodeClients;
use common_meta::heartbeat::handler::parse_mailbox_message::ParseMailboxMessageHandler;
use common_meta::heartbeat::handler::HandlerGroupExecutor;
use common_telemetry::info;
#[cfg(feature = "tokio-console")]
use common_telemetry::logging::TracingOptions;
use common_time::timezone::set_default_timezone;
use frontend::frontend::FrontendOptions;
Expand Down Expand Up @@ -164,12 +163,10 @@ impl StartCommand {
opts.logging.level.clone_from(&global_options.log_level);
}

#[cfg(feature = "tokio-console")]
if global_options.tokio_console_addr.is_some() {
opts.tracing = TracingOptions {
tokio_console_addr: global_options.tokio_console_addr.clone(),
};
}
opts.tracing = TracingOptions {
#[cfg(feature = "tokio-console")]
tokio_console_addr: global_options.tokio_console_addr.clone(),
};

let tls_opts = TlsOption::new(
self.tls_mode.clone(),
Expand Down
11 changes: 4 additions & 7 deletions src/cmd/src/metasrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::time::Duration;
use async_trait::async_trait;
use clap::Parser;
use common_telemetry::info;
#[cfg(feature = "tokio-console")]
use common_telemetry::logging::TracingOptions;
use meta_srv::bootstrap::MetasrvInstance;
use meta_srv::metasrv::MetasrvOptions;
Expand Down Expand Up @@ -143,12 +142,10 @@ impl StartCommand {
opts.logging.level.clone_from(&global_options.log_level);
}

#[cfg(feature = "tokio-console")]
if global_options.tokio_console_addr.is_some() {
opts.tracing = TracingOptions {
tokio_console_addr: global_options.tokio_console_addr.clone(),
};
}
opts.tracing = TracingOptions {
#[cfg(feature = "tokio-console")]
tokio_console_addr: global_options.tokio_console_addr.clone(),
};

if let Some(addr) = &self.bind_addr {
opts.bind_addr.clone_from(addr);
Expand Down
10 changes: 4 additions & 6 deletions src/cmd/src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,10 @@ impl StartCommand {
opts.logging.level.clone_from(&global_options.log_level);
}

#[cfg(feature = "tokio-console")]
if global_options.tokio_console_addr.is_some() {
opts.tracing = TracingOptions {
tokio_console_addr: global_options.tokio_console_addr.clone(),
};
}
opts.tracing = TracingOptions {
#[cfg(feature = "tokio-console")]
tokio_console_addr: global_options.tokio_console_addr.clone(),
};

let tls_opts = TlsOption::new(
self.tls_mode.clone(),
Expand Down

0 comments on commit abbc463

Please sign in to comment.