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) <noreply@anthropic.com>
264 lines
5.6 KiB
JSON
264 lines
5.6 KiB
JSON
{
|
|
"title": "Planner",
|
|
"uid": "trails-planner",
|
|
"annotations": {
|
|
"list": [
|
|
{
|
|
"name": "Deploys",
|
|
"enable": true,
|
|
"datasource": {
|
|
"type": "grafana",
|
|
"uid": "-- Grafana --"
|
|
},
|
|
"iconColor": "rgba(0, 211, 255, 1)",
|
|
"target": {
|
|
"limit": 100,
|
|
"matchAny": false,
|
|
"tags": [
|
|
"deploy"
|
|
],
|
|
"type": "tags"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"timezone": "browser",
|
|
"refresh": "30s",
|
|
"panels": [
|
|
{
|
|
"title": "Active Sessions",
|
|
"type": "stat",
|
|
"gridPos": {
|
|
"h": 6,
|
|
"w": 6,
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "planner_active_sessions",
|
|
"legendFormat": "Sessions"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"title": "Connected Clients",
|
|
"type": "stat",
|
|
"gridPos": {
|
|
"h": 6,
|
|
"w": 6,
|
|
"x": 6,
|
|
"y": 0
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "planner_connected_clients",
|
|
"legendFormat": "Clients"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"title": "BRouter Latency",
|
|
"type": "timeseries",
|
|
"gridPos": {
|
|
"h": 6,
|
|
"w": 12,
|
|
"x": 12,
|
|
"y": 0
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "histogram_quantile(0.50, rate(brouter_request_duration_seconds_bucket[5m]))",
|
|
"legendFormat": "p50"
|
|
},
|
|
{
|
|
"expr": "histogram_quantile(0.95, rate(brouter_request_duration_seconds_bucket[5m]))",
|
|
"legendFormat": "p95"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"unit": "s"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"title": "Request Rate by Route",
|
|
"type": "timeseries",
|
|
"gridPos": {
|
|
"h": 8,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 6
|
|
},
|
|
"targets": [
|
|
{
|
|
"expr": "sum(rate(http_request_duration_seconds_count{job=\"planner\"}[5m])) by (route)",
|
|
"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])) or vector(0)) / sum(rate(overpass_upstream_requests_total[5m]))",
|
|
"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])) or vector(0)) / sum(rate(overpass_cache_events_total[5m]))",
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|