Watch
0
0
Fork
You've already forked hyperhive
0

swarm-notify-router: give the event duration histogram second-scale bounds

This commit is contained in:
damocles 2026-11-04 22:51:14 +01:00 • committed by mara
commit a6a0ab7aef

View file

@ -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