From 06d0209d0ba30fc339fca8cbbe6c17f16d7b53e2 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Wed, 27 Jun 2018 16:53:42 -0700 Subject: [PATCH] proxy: Replace >=100,000 ms latency buckets with 1, 2, 3, 4, and 5 ms (#1218) This branch adds buckets for latencies below 10 ms to the proxy's latency histograms, and removes the buckets for 100, 200, 300, 400, and 500 seconds, so the largest non-infinity bucket is 50,000 ms. It also removes comments that claimed that these buckets were the same as those created by the control plane, as this is no longer true (the metrics are now scraped by Prometheus from the proxy directly). Closes #1208 Signed-off-by: Eliza Weisman --- proxy/src/telemetry/metrics/latency.rs | 36 +++++--------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/proxy/src/telemetry/metrics/latency.rs b/proxy/src/telemetry/metrics/latency.rs index 19ee72f33..a5b507de8 100644 --- a/proxy/src/telemetry/metrics/latency.rs +++ b/proxy/src/telemetry/metrics/latency.rs @@ -3,40 +3,33 @@ use std::time::Duration; use super::histogram::{Bounds, Bucket, Histogram}; /// The maximum value (inclusive) for each latency bucket in -/// tenths of a millisecond. +/// milliseconds. pub const BOUNDS: &Bounds = &Bounds(&[ - // The controller telemetry server creates 5 sets of 5 linear buckets - // each: - // prometheus.LinearBuckets(1, 1, 5), + Bucket::Le(1), + Bucket::Le(2), + Bucket::Le(3), + Bucket::Le(4), + Bucket::Le(5), Bucket::Le(10), Bucket::Le(20), Bucket::Le(30), Bucket::Le(40), Bucket::Le(50), - // prometheus.LinearBuckets(10, 10, 5), Bucket::Le(100), Bucket::Le(200), Bucket::Le(300), Bucket::Le(400), Bucket::Le(500), - // prometheus.LinearBuckets(100, 100, 5), Bucket::Le(1_000), Bucket::Le(2_000), Bucket::Le(3_000), Bucket::Le(4_000), Bucket::Le(5_000), - // prometheus.LinearBuckets(1000, 1000, 5), Bucket::Le(10_000), Bucket::Le(20_000), Bucket::Le(30_000), Bucket::Le(40_000), Bucket::Le(50_000), - // prometheus.LinearBuckets(10000, 10000, 5), - Bucket::Le(100_000), - Bucket::Le(200_000), - Bucket::Le(300_000), - Bucket::Le(400_000), - Bucket::Le(500_000), // A final upper bound. Bucket::Inf, ]); @@ -45,10 +38,6 @@ pub const BOUNDS: &Bounds = &Bounds(&[ #[derive(Debug, Default, Clone)] pub struct Ms(Duration); -// /// A duration in microseconds. -// #[derive(Debug, Default, Clone)] -// pub struct Us(pub Duration); - impl Into for Ms { fn into(self) -> u64 { self.0.as_secs().saturating_mul(1_000) @@ -67,16 +56,3 @@ impl Default for Histogram { Histogram::new(BOUNDS) } } - -// impl Into for Us { -// fn into(self) -> u64 { -// self.0.as_secs().saturating_mul(1_000_000) -// .saturating_add(u64::from(self.0.subsec_nanos()) / 1_000) -// } -// } - -// impl Default for Histogram { -// fn default() -> Self { -// Histogram::new(&BOUNDS) -// } -// }