Skip to content

Commit 372251d

Browse files
apollo_network_benchmark: setup tokio metrics exporter
1 parent 1c44237 commit 372251d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_network_benchmark/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ clap = { workspace = true, features = ["derive", "env"] }
1313
lazy_static.workspace = true
1414
metrics-exporter-prometheus.workspace = true
1515
tokio = { workspace = true, features = ["full", "sync"] }
16+
tokio-metrics = { workspace = true, features = ["metrics-rs-integration", "rt"] }
1617
tracing.workspace = true
1718
tracing-subscriber.workspace = true
1819

crates/apollo_network_benchmark/src/bin/broadcast_network_stress_test_node/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
//! Runs a node that stress tests the p2p communication of the network.
22
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
3+
use std::time::Duration;
34

45
use clap::Parser;
56
use metrics_exporter_prometheus::PrometheusBuilder;
7+
use tokio_metrics::RuntimeMetricsReporterBuilder;
68
use tracing::Level;
79

810
#[cfg(test)]
@@ -39,5 +41,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3941

4042
builder.install().expect("Failed to install prometheus recorder/exporter");
4143

44+
// Start the tokio runtime metrics reporter to automatically collect and export runtime metrics
45+
tokio::spawn(
46+
RuntimeMetricsReporterBuilder::default()
47+
.with_interval(Duration::from_secs(1))
48+
.describe_and_run(),
49+
);
50+
4251
Ok(())
4352
}

0 commit comments

Comments
 (0)