Files
nix-config/modules/nixos/services/grafana/dashboards/caddy.json
mjallen18 70002a19e2 hmm
2026-04-07 18:39:42 -05:00

297 lines
9.0 KiB
JSON
Executable File

{
"title": "Caddy",
"uid": "jallen-caddy",
"schemaVersion": 38,
"version": 1,
"refresh": "30s",
"time": { "from": "now-1h", "to": "now" },
"templating": {
"list": [
{
"name": "datasource",
"type": "datasource",
"query": "prometheus",
"current": {},
"hide": 0,
"label": "Datasource"
},
{
"name": "handler",
"type": "query",
"datasource": { "type": "prometheus", "uid": "$datasource" },
"query": "label_values(caddy_http_requests_total, handler)",
"refresh": 2,
"includeAll": true,
"allValue": ".*",
"label": "Handler"
}
]
},
"panels": [
{
"id": 1,
"type": "stat",
"title": "Request Rate (5m)",
"gridPos": { "x": 0, "y": 0, "w": 4, "h": 4 },
"options": { "reduceOptions": { "calcs": ["lastNotNull"] } },
"fieldConfig": {
"defaults": {
"unit": "reqps",
"thresholds": {
"mode": "absolute",
"steps": [{ "color": "blue", "value": null }]
},
"color": { "mode": "thresholds" }
}
},
"targets": [
{
"expr": "sum(rate(caddy_http_requests_total[5m]))",
"legendFormat": "req/s",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 2,
"type": "stat",
"title": "Error Rate (5m)",
"gridPos": { "x": 4, "y": 0, "w": 4, "h": 4 },
"options": { "reduceOptions": { "calcs": ["lastNotNull"] } },
"fieldConfig": {
"defaults": {
"unit": "reqps",
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "green", "value": null },
{ "color": "red", "value": 0.01 }
]
},
"color": { "mode": "thresholds" }
}
},
"targets": [
{
"expr": "sum(rate(caddy_http_requests_total{code=~\"5..\"}[5m]))",
"legendFormat": "5xx/s",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 3,
"type": "stat",
"title": "Active Requests",
"gridPos": { "x": 8, "y": 0, "w": 4, "h": 4 },
"options": { "reduceOptions": { "calcs": ["lastNotNull"] } },
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [{ "color": "blue", "value": null }]
},
"color": { "mode": "thresholds" }
}
},
"targets": [
{
"expr": "sum(caddy_http_active_requests)",
"legendFormat": "active",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 4,
"type": "stat",
"title": "P99 Latency (5m)",
"gridPos": { "x": 12, "y": 0, "w": 4, "h": 4 },
"options": { "reduceOptions": { "calcs": ["lastNotNull"] } },
"fieldConfig": {
"defaults": {
"unit": "s",
"decimals": 3,
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "green", "value": null },
{ "color": "yellow", "value": 0.5 },
{ "color": "red", "value": 2 }
]
},
"color": { "mode": "thresholds" }
}
},
"targets": [
{
"expr": "histogram_quantile(0.99, sum(rate(caddy_http_request_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "P99",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 5,
"type": "stat",
"title": "Total Bytes Received",
"gridPos": { "x": 16, "y": 0, "w": 4, "h": 4 },
"options": { "reduceOptions": { "calcs": ["lastNotNull"] } },
"fieldConfig": {
"defaults": {
"unit": "bytes",
"thresholds": {
"mode": "absolute",
"steps": [{ "color": "blue", "value": null }]
},
"color": { "mode": "thresholds" }
}
},
"targets": [
{
"expr": "sum(caddy_http_request_size_bytes_sum)",
"legendFormat": "bytes in",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 6,
"type": "stat",
"title": "Total Bytes Sent",
"gridPos": { "x": 20, "y": 0, "w": 4, "h": 4 },
"options": { "reduceOptions": { "calcs": ["lastNotNull"] } },
"fieldConfig": {
"defaults": {
"unit": "bytes",
"thresholds": {
"mode": "absolute",
"steps": [{ "color": "blue", "value": null }]
},
"color": { "mode": "thresholds" }
}
},
"targets": [
{
"expr": "sum(caddy_http_response_size_bytes_sum)",
"legendFormat": "bytes out",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 7,
"type": "timeseries",
"title": "Request Rate by Status Code",
"gridPos": { "x": 0, "y": 4, "w": 12, "h": 8 },
"fieldConfig": {
"defaults": {
"unit": "reqps",
"custom": { "lineWidth": 2, "fillOpacity": 5 }
},
"overrides": [
{ "matcher": { "id": "byName", "options": "5xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "red", "mode": "fixed" } }] },
{ "matcher": { "id": "byName", "options": "4xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "orange", "mode": "fixed" } }] },
{ "matcher": { "id": "byName", "options": "2xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "green", "mode": "fixed" } }] },
{ "matcher": { "id": "byName", "options": "3xx" }, "properties": [{ "id": "color", "value": { "fixedColor": "blue", "mode": "fixed" } }] }
]
},
"targets": [
{
"expr": "sum(rate(caddy_http_requests_total{code=~\"2..\"}[5m]))",
"legendFormat": "2xx",
"datasource": { "type": "prometheus", "uid": "$datasource" }
},
{
"expr": "sum(rate(caddy_http_requests_total{code=~\"3..\"}[5m]))",
"legendFormat": "3xx",
"datasource": { "type": "prometheus", "uid": "$datasource" }
},
{
"expr": "sum(rate(caddy_http_requests_total{code=~\"4..\"}[5m]))",
"legendFormat": "4xx",
"datasource": { "type": "prometheus", "uid": "$datasource" }
},
{
"expr": "sum(rate(caddy_http_requests_total{code=~\"5..\"}[5m]))",
"legendFormat": "5xx",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 8,
"type": "timeseries",
"title": "Request Latency Percentiles",
"gridPos": { "x": 12, "y": 4, "w": 12, "h": 8 },
"fieldConfig": {
"defaults": {
"unit": "s",
"decimals": 3,
"custom": { "lineWidth": 2 }
}
},
"targets": [
{
"expr": "histogram_quantile(0.50, sum(rate(caddy_http_request_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "P50",
"datasource": { "type": "prometheus", "uid": "$datasource" }
},
{
"expr": "histogram_quantile(0.90, sum(rate(caddy_http_request_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "P90",
"datasource": { "type": "prometheus", "uid": "$datasource" }
},
{
"expr": "histogram_quantile(0.99, sum(rate(caddy_http_request_duration_seconds_bucket[5m])) by (le))",
"legendFormat": "P99",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 9,
"type": "timeseries",
"title": "Request Rate by Handler",
"gridPos": { "x": 0, "y": 12, "w": 12, "h": 8 },
"fieldConfig": {
"defaults": {
"unit": "reqps",
"custom": { "lineWidth": 2, "fillOpacity": 5 }
}
},
"targets": [
{
"expr": "sum(rate(caddy_http_requests_total{handler=~\"$handler\"}[5m])) by (handler)",
"legendFormat": "{{handler}}",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
},
{
"id": 10,
"type": "timeseries",
"title": "Bandwidth",
"gridPos": { "x": 12, "y": 12, "w": 12, "h": 8 },
"fieldConfig": {
"defaults": {
"unit": "Bps",
"custom": { "lineWidth": 2, "fillOpacity": 10 }
}
},
"targets": [
{
"expr": "sum(rate(caddy_http_request_size_bytes_sum[5m]))",
"legendFormat": "Inbound",
"datasource": { "type": "prometheus", "uid": "$datasource" }
},
{
"expr": "sum(rate(caddy_http_response_size_bytes_sum[5m]))",
"legendFormat": "Outbound",
"datasource": { "type": "prometheus", "uid": "$datasource" }
}
]
}
]
}