diff --git a/swarm-notify-router/src/metrics.rs b/swarm-notify-router/src/metrics.rs index 5d98cfcd..d6c8f91b 100644 --- a/swarm-notify-router/src/metrics.rs +++ b/swarm-notify-router/src/metrics.rs @@ -28,6 +28,13 @@ use opentelemetry_sdk::metrics::SdkMeterProvider; const METER: &str = "hyperhive.notify_router"; +/// Seconds. Handling one event is a few queue and store round trips, in +/// milliseconds; a review request waits on the controller's answer, up to 30 +/// seconds. The SDK's own bounds start at 5 and are made for milliseconds. +const DURATION_BOUNDARIES: [f64; 12] = [ + 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 30.0, +]; + /// What came of handling one event. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Handled { @@ -108,6 +115,7 @@ impl Metrics { duration: meter .f64_histogram(format!("{METER}.event.duration")) .with_unit("s") + .with_boundaries(DURATION_BOUNDARIES.to_vec()) .build(), todos: meter.u64_counter(format!("{METER}.todos")).build(), reviews: meter