Add Prometheus metrics + Grafana panels for Overpass proxy

Adds four metrics surfaced via the existing /metrics endpoint:
- overpass_cache_events_total{result=hit|miss|coalesced}
- overpass_cache_size (gauge)
- overpass_upstream_duration_seconds (histogram)
- overpass_upstream_requests_total{status} — covers 2xx/4xx/5xx and
  an explicit "error" label for network-level failures

Grafana dashboards/planner.json gets a new row:
- Upstream health (5m 2xx success ratio, red <90%, green >99%)
- Cache hit ratio
- Cache size
- Upstream p95 latency
Plus timeseries panels for cache event breakdown, upstream status
over time, and p50/p95/p99 upstream latency.

The success-rate formula uses clamp_min(..., 1) on the denominator so
it doesn't NaN when traffic is zero.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-04-18 02:11:54 +02:00
parent febdf6a9d3
commit 62e208d850
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
3 changed files with 208 additions and 0 deletions

View file

@ -97,6 +97,168 @@
"legendFormat": "{{route}}"
}
]
},
{
"title": "Overpass Upstream Health (5m success rate)",
"type": "stat",
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 14
},
"targets": [
{
"expr": "sum(rate(overpass_upstream_requests_total{status=~\"2..\"}[5m])) / clamp_min(sum(rate(overpass_upstream_requests_total[5m])), 1)",
"legendFormat": "success"
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"min": 0,
"max": 1,
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "red", "value": null },
{ "color": "orange", "value": 0.9 },
{ "color": "green", "value": 0.99 }
]
}
}
}
},
{
"title": "Overpass Cache Hit Ratio (5m)",
"type": "stat",
"gridPos": {
"h": 5,
"w": 6,
"x": 6,
"y": 14
},
"targets": [
{
"expr": "sum(rate(overpass_cache_events_total{result=\"hit\"}[5m])) / clamp_min(sum(rate(overpass_cache_events_total[5m])), 1)",
"legendFormat": "hit ratio"
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"min": 0,
"max": 1
}
}
},
{
"title": "Overpass Cache Size",
"type": "stat",
"gridPos": {
"h": 5,
"w": 6,
"x": 12,
"y": 14
},
"targets": [
{
"expr": "overpass_cache_size",
"legendFormat": "entries"
}
]
},
{
"title": "Overpass Upstream p95",
"type": "stat",
"gridPos": {
"h": 5,
"w": 6,
"x": 18,
"y": 14
},
"targets": [
{
"expr": "histogram_quantile(0.95, sum(rate(overpass_upstream_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "p95"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
}
}
},
{
"title": "Overpass Cache Events",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 19
},
"targets": [
{
"expr": "sum by (result) (rate(overpass_cache_events_total[5m]))",
"legendFormat": "{{result}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "ops"
}
}
},
{
"title": "Overpass Upstream Status",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 19
},
"targets": [
{
"expr": "sum by (status) (rate(overpass_upstream_requests_total[5m]))",
"legendFormat": "{{status}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "ops"
}
}
},
{
"title": "Overpass Upstream Latency",
"type": "timeseries",
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 26
},
"targets": [
{
"expr": "histogram_quantile(0.50, sum(rate(overpass_upstream_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "p50"
},
{
"expr": "histogram_quantile(0.95, sum(rate(overpass_upstream_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "p95"
},
{
"expr": "histogram_quantile(0.99, sum(rate(overpass_upstream_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "p99"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
}
}
}
]
}