From 278e74f08e050cba7f9e64bde8d4cf22f1486818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sat, 18 Apr 2026 02:42:50 +0200 Subject: [PATCH] Fix Overpass health + cache-hit stat panels: vector(0) not clamp_min MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original formulas used clamp_min(denominator, 1) to avoid divide- by-zero, but that inflates the denominator when request rate is < 1/s. Real example from prod: ~0.04 req/s, all successful, displayed as 1.02% health (red) instead of ~100%. Switch to (numerator or vector(0)) / denominator: - Missing "hit" series (no cache hits yet) → numerator resolves to 0 instead of empty set, so the stat shows 0% instead of "No data". - Zero traffic (empty denominator) → whole expr is empty, Grafana renders "No data", which is the correct behaviour for a health stat when nothing's happening. - Non-zero low traffic → ratio is true ratio, not artificially depressed by the clamp. Co-Authored-By: Claude Opus 4.7 (1M context) --- infrastructure/grafana/dashboards/planner.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/grafana/dashboards/planner.json b/infrastructure/grafana/dashboards/planner.json index 084fa8e..97aa026 100644 --- a/infrastructure/grafana/dashboards/planner.json +++ b/infrastructure/grafana/dashboards/planner.json @@ -109,7 +109,7 @@ }, "targets": [ { - "expr": "sum(rate(overpass_upstream_requests_total{status=~\"2..\"}[5m])) / clamp_min(sum(rate(overpass_upstream_requests_total[5m])), 1)", + "expr": "(sum(rate(overpass_upstream_requests_total{status=~\"2..\"}[5m])) or vector(0)) / sum(rate(overpass_upstream_requests_total[5m]))", "legendFormat": "success" } ], @@ -140,7 +140,7 @@ }, "targets": [ { - "expr": "sum(rate(overpass_cache_events_total{result=\"hit\"}[5m])) / clamp_min(sum(rate(overpass_cache_events_total[5m])), 1)", + "expr": "(sum(rate(overpass_cache_events_total{result=\"hit\"}[5m])) or vector(0)) / sum(rate(overpass_cache_events_total[5m]))", "legendFormat": "hit ratio" } ],