Skip to content

Commit

Permalink
Show nice log
Browse files Browse the repository at this point in the history
  • Loading branch information
xgreenx committed Oct 14, 2024
1 parent aa6120a commit 5aea57a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/fuel-core/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,13 @@ impl Command {
profiling: _,
} = self;

info!("Metrics config: {:?}", metrics);
let enabled_metrics = metrics.list_of_enabled();

if !enabled_metrics.is_empty() {
info!("`{:?}` metrics are enabled", enabled_metrics);
} else {
info!("All metrics are disabled");
}

let addr = net::SocketAddr::new(graphql.ip, graphql.port);

Expand Down
9 changes: 9 additions & 0 deletions crates/metrics/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ pub enum Module {
pub trait DisableConfig {
/// Returns `true` if the given module is enabled.
fn is_enabled(&self, module: Module) -> bool;

/// Returns the list of enabled modules.
fn list_of_enabled(&self) -> Vec<Module>;
}

impl DisableConfig for Vec<Module> {
fn is_enabled(&self, module: Module) -> bool {
!self.contains(&module) && !self.contains(&Module::All)
}

fn list_of_enabled(&self) -> Vec<Module> {
Module::iter()
.filter(|module| self.is_enabled(*module) && *module != Module::All)
.collect()
}
}

static HELP_STRING: Lazy<String> = Lazy::new(|| {
Expand Down

0 comments on commit 5aea57a

Please sign in to comment.