Skip to content

Commit

Permalink
chore: make metrics logging to work with local networks only
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed Dec 16, 2024
1 parent 87f2f70 commit 4746046
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ant-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ path = "src/main.rs"

[features]
default = ["metrics"]
local = ["ant-bootstrap/local", "autonomi/local"]
metrics = ["ant-logging/process-metrics"]
local = ["ant-bootstrap/local", "autonomi/local", "ant-logging/process-metrics"]
metrics = []

[[bench]]
name = "files"
Expand Down
4 changes: 2 additions & 2 deletions ant-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub use access::user_data;
use clap::Parser;
use color_eyre::Result;

#[cfg(feature = "metrics")]
#[cfg(feature = "local")]
use ant_logging::metrics::init_metrics;
use ant_logging::{LogBuilder, LogFormat, ReloadHandle, WorkerGuard};
use opt::Opt;
Expand All @@ -38,7 +38,7 @@ async fn main() -> Result<()> {
ant_protocol::version::set_network_id(network_id);
}
let _log_guards = init_logging_and_metrics(&opt)?;
#[cfg(feature = "metrics")]
#[cfg(feature = "local")]
tokio::spawn(init_metrics(std::process::id()));

// Log the full command that was run and the git version
Expand Down
4 changes: 2 additions & 2 deletions ant-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ path = "src/bin/antnode/main.rs"
default = ["metrics", "upnp", "open-metrics", "encrypt-records"]
encrypt-records = ["ant-networking/encrypt-records"]
extension-module = ["pyo3/extension-module"]
local = ["ant-networking/local", "ant-evm/local", "ant-bootstrap/local"]
local = ["ant-networking/local", "ant-evm/local", "ant-bootstrap/local", "ant-logging/process-metrics"]
loud = ["ant-networking/loud"] # loud mode: print important messages to console
metrics = ["ant-logging/process-metrics"]
metrics = []
nightly = []
open-metrics = ["ant-networking/open-metrics", "prometheus-client"]
otlp = ["ant-logging/otlp"]
Expand Down
4 changes: 2 additions & 2 deletions ant-node/src/bin/antnode/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod subcommands;
use crate::subcommands::EvmNetworkCommand;
use ant_bootstrap::{BootstrapCacheConfig, BootstrapCacheStore, PeersArgs};
use ant_evm::{get_evm_network_from_env, EvmNetwork, RewardsAddress};
#[cfg(feature = "metrics")]
#[cfg(feature = "local")]
use ant_logging::metrics::init_metrics;
use ant_logging::{Level, LogFormat, LogOutputDest, ReloadHandle};
use ant_node::{Marker, NodeBuilder, NodeEvent, NodeEventsReceiver};
Expand Down Expand Up @@ -306,7 +306,7 @@ fn main() -> Result<()> {
// Create a tokio runtime per `run_node` attempt, this ensures
// any spawned tasks are closed before we would attempt to run
// another process with these args.
#[cfg(feature = "metrics")]
#[cfg(feature = "local")]
rt.spawn(init_metrics(std::process::id()));
let initial_peres = rt.block_on(opt.peers.get_addrs(None, Some(100)))?;
debug!("Node's owner set to: {:?}", opt.owner);
Expand Down

0 comments on commit 4746046

Please sign in to comment.