diff --git a/Cargo.lock b/Cargo.lock index de5979120d9..3b7d1814b50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2112,6 +2112,7 @@ dependencies = [ "metrics-exporter-prometheus", "rstest", "tokio", + "tokio-metrics", "tracing", "tracing-subscriber", ] diff --git a/crates/apollo_network_benchmark/Cargo.toml b/crates/apollo_network_benchmark/Cargo.toml index 693da085bcf..29b683b9e71 100644 --- a/crates/apollo_network_benchmark/Cargo.toml +++ b/crates/apollo_network_benchmark/Cargo.toml @@ -13,6 +13,7 @@ clap = { workspace = true, features = ["derive", "env"] } lazy_static.workspace = true metrics-exporter-prometheus.workspace = true tokio = { workspace = true, features = ["full", "sync"] } +tokio-metrics = { workspace = true, features = ["metrics-rs-integration", "rt"] } tracing.workspace = true tracing-subscriber.workspace = true diff --git a/crates/apollo_network_benchmark/src/bin/broadcast_network_stress_test_node/main.rs b/crates/apollo_network_benchmark/src/bin/broadcast_network_stress_test_node/main.rs index 9ffc39a9bbd..2dab1fccbaa 100644 --- a/crates/apollo_network_benchmark/src/bin/broadcast_network_stress_test_node/main.rs +++ b/crates/apollo_network_benchmark/src/bin/broadcast_network_stress_test_node/main.rs @@ -1,8 +1,10 @@ //! Runs a node that stress tests the p2p communication of the network. use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; +use std::time::Duration; use clap::Parser; use metrics_exporter_prometheus::PrometheusBuilder; +use tokio_metrics::RuntimeMetricsReporterBuilder; use tracing::Level; #[cfg(test)] @@ -39,5 +41,12 @@ async fn main() -> Result<(), Box> { builder.install().expect("Failed to install prometheus recorder/exporter"); + // Start the tokio runtime metrics reporter to automatically collect and export runtime metrics + tokio::spawn( + RuntimeMetricsReporterBuilder::default() + .with_interval(Duration::from_secs(1)) + .describe_and_run(), + ); + Ok(()) }