Skip to content

Commit

Permalink
Merge pull request #4490 from nymtech/feature-gate-client-metrics
Browse files Browse the repository at this point in the history
Feature gate core-client metrics server
  • Loading branch information
tommyv1987 committed Mar 27, 2024
2 parents a44cd1c + 5fe6a2c commit 0a21399
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions common/client-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@ default = []
cli = ["clap"]
fs-surb-storage = ["sqlx"]
wasm = ["nym-gateway-client/wasm"]
metrics-server = []
7 changes: 5 additions & 2 deletions common/client-core/src/client/packet_statistics_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use hyper_util::rt::TokioIo;
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
use std::convert::Infallible;
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
#[cfg(feature = "metrics-server")]
use std::net::SocketAddr;
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
use tokio::net::TcpListener;
Expand Down Expand Up @@ -508,7 +509,7 @@ impl PacketStatisticsControl {
if #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] {
log::warn!("Metrics server is not supported on wasm32-unknown-unknown");
let listener: Option<WasmEmpty> = None;
} else {
} else if #[cfg(feature = "metrics-server")] {
let mut metrics_port = 18000;
let listener: Option<TcpListener>;
loop {
Expand All @@ -527,7 +528,9 @@ impl PacketStatisticsControl {
}
};
}

} else {
log::info!("Metrics server is disabled!");
let listener: Option<TcpListener> = None;
}
}

Expand Down

0 comments on commit 0a21399

Please sign in to comment.