diff --git a/shotover/benches/benches/chain.rs b/shotover/benches/benches/chain.rs index f303f80f9..3639f09e0 100644 --- a/shotover/benches/benches/chain.rs +++ b/shotover/benches/benches/chain.rs @@ -21,7 +21,7 @@ use shotover::transforms::throttling::RequestThrottlingConfig; use shotover::transforms::{TransformConfig, Wrapper}; fn criterion_benchmark(c: &mut Criterion) { - super::init(); + crate::init(); let rt = tokio::runtime::Runtime::new().unwrap(); let mut group = c.benchmark_group("transform"); group.noise_threshold(0.2); diff --git a/shotover/benches/benches/codec/cassandra.rs b/shotover/benches/benches/codec/cassandra.rs index 0035d90b6..13f5a63fa 100644 --- a/shotover/benches/benches/codec/cassandra.rs +++ b/shotover/benches/benches/codec/cassandra.rs @@ -15,6 +15,7 @@ use shotover::message::Message; use tokio_util::codec::{Decoder, Encoder}; fn criterion_benchmark(c: &mut Criterion) { + crate::init(); let mut group = c.benchmark_group("cassandra_codec"); group.noise_threshold(0.2); diff --git a/shotover/benches/benches/codec/kafka.rs b/shotover/benches/benches/codec/kafka.rs index 734824e46..99810c13e 100644 --- a/shotover/benches/benches/codec/kafka.rs +++ b/shotover/benches/benches/codec/kafka.rs @@ -22,6 +22,7 @@ const KAFKA_REQUESTS: &[(&[u8], &str)] = &[ ]; fn criterion_benchmark(c: &mut Criterion) { + crate::init(); let mut group = c.benchmark_group("kafka_codec"); group.noise_threshold(0.2); diff --git a/shotover/benches/benches/main.rs b/shotover/benches/benches/main.rs index 68cb60ba4..297e22588 100644 --- a/shotover/benches/benches/main.rs +++ b/shotover/benches/benches/main.rs @@ -1,4 +1,5 @@ use criterion::criterion_main; +use metrics_exporter_prometheus::PrometheusBuilder; mod chain; mod codec; @@ -6,6 +7,9 @@ mod codec; fn init() { std::env::set_var("RUST_BACKTRACE", "1"); std::env::set_var("RUST_LIB_BACKTRACE", "0"); + + let recorder = PrometheusBuilder::new().build_recorder(); + metrics::set_boxed_recorder(Box::new(recorder)).ok(); } criterion_main!(