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.

chore(personhog): densify handoff phase and stash wait histogram buckets (#79935)

Zach Brownb692cba8afb2
diff --git a/rust/personhog-router/src/main.rs b/rust/personhog-router/src/main.rs
index d03a9d7fc066..994bd1eceb20 100644
--- a/rust/personhog-router/src/main.rs
+++ b/rust/personhog-router/src/main.rs
@@ -429,9 +429,22 @@ fn install_metrics_recorder() -> PrometheusHandle {
// Sub-second buckets at the bottom because the source is
// millisecond-precise; the top still reaches far past the
// handoff deadline so a stall is never collapsed into +Inf.
+ // Dense through the seconds range: healthy phases finish in
+ // hundreds of milliseconds to a few seconds, and during deploy
+ // churn the interesting question is where in 1–10s a phase landed —
+ // the old 2s → 5s gap rendered any tail there as an interpolated
+ // "4.7s" regardless of the real value. The top still reaches far
+ // past the handoff deadline so a stall is never collapsed into
+ // +Inf.
const HANDOFF_PHASE_BUCKETS: &[f64] = &[
- 50.0, 250.0, 1000.0, 2000.0, 5000.0, 10000.0, 30000.0, 60000.0, 120000.0, 300000.0,
- 600000.0,
+ 50.0, 250.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 5000.0, 7500.0, 10000.0, 15000.0,
+ 30000.0, 60000.0, 120000.0, 300000.0, 600000.0,
+ ];
+ // Stash waits span "drained at activation" (hundreds of ms) to
+ // "parked across chained handoffs" (seconds); the ceiling is
+ // max_stash_wait, so resolution past ~30s buys nothing.
+ const STASH_WAIT_BUCKETS: &[f64] = &[
+ 100.0, 250.0, 500.0, 1000.0, 2000.0, 3000.0, 5000.0, 7500.0, 10000.0, 15000.0, 30000.0,
];
PrometheusBuilder::new()
.add_global_label("service", "personhog-router")
@@ -452,6 +465,16 @@ fn install_metrics_recorder() -> PrometheusHandle {
HANDOFF_PHASE_BUCKETS,
)
.unwrap()
+ .set_buckets_for_metric(
+ Matcher::Full("personhog_router_stash_wait_duration_ms".into()),
+ STASH_WAIT_BUCKETS,
+ )
+ .unwrap()
+ .set_buckets_for_metric(
+ Matcher::Full("personhog_router_stash_drain_duration_ms".into()),
+ STASH_WAIT_BUCKETS,
+ )
+ .unwrap()
// Per-request forwarding spans live in single-digit milliseconds;
// the default ladder's 10 → 50 ms step blurs them and pins
// interpolated quantiles to bucket edges.