Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(propdefs): re-center the histogram bucket ladders (#80130)

Eli Reisman8c9fccbe9c6f
diff --git a/rust/property-defs-rs/src/metrics_buckets.rs b/rust/property-defs-rs/src/metrics_buckets.rs
index 5698bc673ec3..c65b72d2d83e 100644
--- a/rust/property-defs-rs/src/metrics_buckets.rs
+++ b/rust/property-defs-rs/src/metrics_buckets.rs
@@ -2,9 +2,11 @@
//!
//! `common-metrics`' default ladder is millisecond-shaped and tops out at 10s, which suits the
//! per-chunk write timings. It does not suit `prop_defs_batch_acquire_time_ms`, which measures how
-//! long the consumer waits for a batch to fill and is therefore bounded by `max_issue_period`
-//! (500s in production), not by any database operation. Left on the default ladder its whole
-//! distribution lands in the overflow bucket and no quantile over it is meaningful.
+//! long the consumer waits for a batch to fill and is therefore bounded by `max_issue_period`,
+//! not by any database operation. Deploys raise that well above the in-code default, so the
+//! ceiling here is sized against the deployed value rather than the default. Left on the default
+//! ladder its whole distribution lands in the overflow bucket and no quantile over it is
+//! meaningful.
//!
//! Wired in at startup via `common_metrics::setup_metrics_routes_with_overrides`.
//!
@@ -23,13 +25,15 @@ use crate::metrics_consts::{
};
// Batch-acquire spans "the channel already had a full batch waiting" to "we sat here until
-// max_issue_period expired", so the ladder runs from 1ms through the 500s production timeout.
+// max_issue_period expired", so the ladder has to cover milliseconds through that timeout.
+// Boundaries step by roughly 2x rather than clustering anywhere, because this wait tracks arrival
+// rate and consumer lag: it moves by an order of magnitude between quiet and backlogged periods,
+// so a ladder centered on any one operating point loses resolution as soon as load shifts.
// It does not resolve below a millisecond: `timing_guard` truncates to integer milliseconds, so
-// a wait shorter than that records 0.0 regardless of the first boundary. Coarse at the top,
-// because past a minute the only question is which order of magnitude.
+// a wait shorter than that records 0.0 regardless of the first boundary.
const BATCH_ACQUIRE_BUCKETS_MS: &[f64] = &[
- 1.0, 10.0, 100.0, 500.0, 1_000.0, 5_000.0, 10_000.0, 30_000.0, 60_000.0, 120_000.0, 300_000.0,
- 600_000.0,
+ 100.0, 250.0, 500.0, 1_000.0, 2_000.0, 4_000.0, 8_000.0, 15_000.0, 25_000.0, 40_000.0,
+ 60_000.0, 120_000.0, 300_000.0, 600_000.0,
];
// Per-chunk write times run in the hundreds of milliseconds normally. The 30s ceiling leaves room
@@ -39,12 +43,16 @@ const BATCH_WRITE_BUCKETS_MS: &[f64] = &[
1.0, 5.0, 10.0, 50.0, 100.0, 250.0, 500.0, 1_000.0, 2_000.0, 5_000.0, 10_000.0, 30_000.0,
];
-// Updates per event is a count, not a duration, so the millisecond ladder does not fit it at all:
-// its 10 to 50 gap sits exactly where the mass lives, and typical events yield single digits.
-// This ladder resolves the common range and still reaches update_count_skip_threshold (10000 by
-// default), above which the event is skipped entirely.
+// Updates per event is a count, not a duration, so the millisecond ladder does not fit it.
+// An event fans out to roughly two updates per property, so the bulk of the distribution sits in
+// the low hundreds and the tail runs into the thousands for property-heavy senders. Resolution is
+// concentrated there rather than in the single digits, which only a near-empty event reaches.
+// The top boundary matches update_count_skip_threshold (10000 by default). An event above that
+// threshold yields no updates at all, and the histogram records that as a zero rather than a
+// large value, so no sample ever lands above the top boundary.
const UPDATES_PER_EVENT_BUCKETS: &[f64] = &[
- 1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 21.0, 34.0, 55.0, 100.0, 250.0, 1_000.0, 10_000.0,
+ 1.0, 5.0, 25.0, 50.0, 100.0, 150.0, 200.0, 300.0, 500.0, 750.0, 1_000.0, 2_000.0, 3_000.0,
+ 5_000.0, 10_000.0,
];
pub fn bucket_overrides() -> Vec<(Matcher, &'static [f64])> {