From d45d6e3eafe00485a36850022149fcec9b003a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sun, 29 Mar 2026 22:18:06 +0200 Subject: [PATCH] Unwrap dashboard JSON for Grafana provisioning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Grafana file-based provisioning expects flat dashboard JSON, not the API format with a "dashboard" wrapper. The 4 wrapped dashboards were silently failing to load — only business.json (already flat) worked. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../grafana/dashboards/infrastructure.json | 154 +++-- .../grafana/dashboards/overview.json | 198 ++++-- .../grafana/dashboards/planner.json | 135 ++-- .../grafana/dashboards/service-health.json | 646 ++++++++++++------ 4 files changed, 788 insertions(+), 345 deletions(-) diff --git a/infrastructure/grafana/dashboards/infrastructure.json b/infrastructure/grafana/dashboards/infrastructure.json index 79e7f1e..697fed3 100644 --- a/infrastructure/grafana/dashboards/infrastructure.json +++ b/infrastructure/grafana/dashboards/infrastructure.json @@ -1,56 +1,108 @@ { - "dashboard": { - "title": "Infrastructure", - "uid": "trails-infra", - "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" } + "title": "Infrastructure", + "uid": "trails-infra", + "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": "Process Memory (RSS)", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 }, - "targets": [ - { "expr": "process_resident_memory_bytes", "legendFormat": "{{job}}" } - ], - "fieldConfig": { "defaults": { "unit": "bytes" } } - }, - { - "title": "CPU Usage", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 }, - "targets": [ - { "expr": "rate(process_cpu_seconds_total[5m])", "legendFormat": "{{job}}" } - ], - "fieldConfig": { "defaults": { "unit": "percentunit" } } - }, - { - "title": "Event Loop Lag", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 }, - "targets": [ - { "expr": "nodejs_eventloop_lag_seconds", "legendFormat": "{{job}}" } - ], - "fieldConfig": { "defaults": { "unit": "s" } } - }, - { - "title": "Open File Descriptors", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 }, - "targets": [ - { "expr": "process_open_fds", "legendFormat": "{{job}}" } - ] } ] - } + }, + "timezone": "browser", + "refresh": "30s", + "panels": [ + { + "title": "Process Memory (RSS)", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "targets": [ + { + "expr": "process_resident_memory_bytes", + "legendFormat": "{{job}}" + } + ], + "fieldConfig": { + "defaults": { + "unit": "bytes" + } + } + }, + { + "title": "CPU Usage", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "targets": [ + { + "expr": "rate(process_cpu_seconds_total[5m])", + "legendFormat": "{{job}}" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percentunit" + } + } + }, + { + "title": "Event Loop Lag", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "targets": [ + { + "expr": "nodejs_eventloop_lag_seconds", + "legendFormat": "{{job}}" + } + ], + "fieldConfig": { + "defaults": { + "unit": "s" + } + } + }, + { + "title": "Open File Descriptors", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "targets": [ + { + "expr": "process_open_fds", + "legendFormat": "{{job}}" + } + ] + } + ] } diff --git a/infrastructure/grafana/dashboards/overview.json b/infrastructure/grafana/dashboards/overview.json index d5e936c..dd7df4a 100644 --- a/infrastructure/grafana/dashboards/overview.json +++ b/infrastructure/grafana/dashboards/overview.json @@ -1,68 +1,142 @@ { - "dashboard": { - "title": "trails.cool Overview", - "uid": "trails-overview", - "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": "trails.cool Overview", + "uid": "trails-overview", + "annotations": { + "list": [ { - "title": "Request Rate", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 }, - "targets": [ - { - "expr": "sum(rate(http_request_duration_seconds_count[5m])) by (job)", - "legendFormat": "{{job}}" - } - ] - }, - { - "title": "Error Rate", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 }, - "targets": [ - { - "expr": "sum(rate(http_request_duration_seconds_count{status=~\"5..\"}[5m])) / sum(rate(http_request_duration_seconds_count[5m])) * 100", - "legendFormat": "Error %" - } - ], - "fieldConfig": { - "defaults": { "unit": "percent", "thresholds": { "steps": [{ "color": "green", "value": null }, { "color": "red", "value": 5 }] } } - } - }, - { - "title": "Latency p50 / p95 / p99", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 }, - "targets": [ - { "expr": "histogram_quantile(0.50, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", "legendFormat": "p50" }, - { "expr": "histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", "legendFormat": "p95" }, - { "expr": "histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", "legendFormat": "p99" } - ], - "fieldConfig": { "defaults": { "unit": "s" } } - }, - { - "title": "Health Status", - "type": "stat", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 }, - "targets": [ - { "expr": "up", "legendFormat": "{{job}}" } - ], - "fieldConfig": { - "defaults": { "mappings": [{ "type": "value", "options": { "0": { "text": "DOWN", "color": "red" }, "1": { "text": "UP", "color": "green" } } }] } + "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": "Request Rate", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "targets": [ + { + "expr": "sum(rate(http_request_duration_seconds_count[5m])) by (job)", + "legendFormat": "{{job}}" + } + ] + }, + { + "title": "Error Rate", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "targets": [ + { + "expr": "sum(rate(http_request_duration_seconds_count{status=~\"5..\"}[5m])) / sum(rate(http_request_duration_seconds_count[5m])) * 100", + "legendFormat": "Error %" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percent", + "thresholds": { + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 5 + } + ] + } + } + } + }, + { + "title": "Latency p50 / p95 / p99", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "targets": [ + { + "expr": "histogram_quantile(0.50, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", + "legendFormat": "p50" + }, + { + "expr": "histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", + "legendFormat": "p95" + }, + { + "expr": "histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", + "legendFormat": "p99" + } + ], + "fieldConfig": { + "defaults": { + "unit": "s" + } + } + }, + { + "title": "Health Status", + "type": "stat", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "targets": [ + { + "expr": "up", + "legendFormat": "{{job}}" + } + ], + "fieldConfig": { + "defaults": { + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "DOWN", + "color": "red" + }, + "1": { + "text": "UP", + "color": "green" + } + } + } + ] + } + } + } + ] } diff --git a/infrastructure/grafana/dashboards/planner.json b/infrastructure/grafana/dashboards/planner.json index c476608..72a9e02 100644 --- a/infrastructure/grafana/dashboards/planner.json +++ b/infrastructure/grafana/dashboards/planner.json @@ -1,51 +1,102 @@ { - "dashboard": { - "title": "Planner", - "uid": "trails-planner", - "annotations": { - "list": [ + "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": [ { - "name": "Deploys", - "enable": true, - "datasource": { "type": "grafana", "uid": "-- Grafana --" }, - "iconColor": "rgba(0, 211, 255, 1)", - "target": { "limit": 100, "matchAny": false, "tags": ["deploy"], "type": "tags" } + "expr": "planner_active_sessions", + "legendFormat": "Sessions" } ] }, - "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 }, - { - "title": "Connected Clients", - "type": "stat", - "gridPos": { "h": 6, "w": 6, "x": 6, "y": 0 }, - "targets": [{ "expr": "planner_connected_clients", "legendFormat": "Clients" }] + "targets": [ + { + "expr": "planner_connected_clients", + "legendFormat": "Clients" + } + ] + }, + { + "title": "BRouter Latency", + "type": "timeseries", + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 0 }, - { - "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}}" } - ] + "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}}" + } + ] + } + ] } diff --git a/infrastructure/grafana/dashboards/service-health.json b/infrastructure/grafana/dashboards/service-health.json index 440fbef..811bde3 100644 --- a/infrastructure/grafana/dashboards/service-health.json +++ b/infrastructure/grafana/dashboards/service-health.json @@ -1,198 +1,464 @@ { - "dashboard": { - "title": "Service Health", - "uid": "trails-service-health", - "annotations": { - "list": [ + "title": "Service Health", + "uid": "trails-service-health", + "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": "PostgreSQL \u2014 Active Connections", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "targets": [ { - "name": "Deploys", - "enable": true, - "datasource": { "type": "grafana", "uid": "-- Grafana --" }, - "iconColor": "rgba(0, 211, 255, 1)", - "target": { "limit": 100, "matchAny": false, "tags": ["deploy"], "type": "tags" } + "expr": "pg_stat_activity_count{datname=\"trails\"}", + "legendFormat": "{{state}}" } ] }, - "timezone": "browser", - "refresh": "30s", - "panels": [ - { - "title": "PostgreSQL — Active Connections", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 }, - "targets": [ - { "expr": "pg_stat_activity_count{datname=\"trails\"}", "legendFormat": "{{state}}" } - ] + { + "title": "PostgreSQL \u2014 Database Size", + "type": "stat", + "gridPos": { + "h": 8, + "w": 6, + "x": 12, + "y": 0 }, - { - "title": "PostgreSQL — Database Size", - "type": "stat", - "gridPos": { "h": 8, "w": 6, "x": 12, "y": 0 }, - "targets": [ - { "expr": "pg_database_size_bytes{datname=\"trails\"}", "legendFormat": "trails" } - ], - "fieldConfig": { "defaults": { "unit": "bytes" } } - }, - { - "title": "PostgreSQL — Transactions/sec", - "type": "timeseries", - "gridPos": { "h": 8, "w": 6, "x": 18, "y": 0 }, - "targets": [ - { "expr": "rate(pg_stat_database_xact_commit{datname=\"trails\"}[5m])", "legendFormat": "commits/s" }, - { "expr": "rate(pg_stat_database_xact_rollback{datname=\"trails\"}[5m])", "legendFormat": "rollbacks/s" } - ] - }, - { - "title": "PostgreSQL — Slowest Queries (pg_stat_statements)", - "type": "table", - "gridPos": { "h": 8, "w": 24, "x": 0, "y": 8 }, - "targets": [ - { - "expr": "topk(10, pg_stat_statements_mean_time_seconds{datname=\"trails\"})", - "legendFormat": "{{query}}", - "format": "table", - "instant": true - } - ] - }, - { - "title": "PostgreSQL — Cache Hit Ratio", - "type": "gauge", - "gridPos": { "h": 8, "w": 6, "x": 0, "y": 16 }, - "targets": [ - { "expr": "pg_stat_database_blks_hit{datname=\"trails\"} / (pg_stat_database_blks_hit{datname=\"trails\"} + pg_stat_database_blks_read{datname=\"trails\"}) * 100", "legendFormat": "hit %" } - ], - "fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100, "thresholds": { "steps": [{ "color": "red", "value": null }, { "color": "yellow", "value": 90 }, { "color": "green", "value": 99 }] } } } - }, - { - "title": "PostgreSQL — Index Scans vs Sequential Scans", - "type": "timeseries", - "gridPos": { "h": 8, "w": 18, "x": 6, "y": 16 }, - "targets": [ - { "expr": "sum(rate(pg_stat_user_tables_idx_scan[5m]))", "legendFormat": "Index scans/s" }, - { "expr": "sum(rate(pg_stat_user_tables_seq_scan[5m]))", "legendFormat": "Sequential scans/s" } - ] - }, - { - "title": "Host — Disk Usage", - "type": "gauge", - "gridPos": { "h": 8, "w": 8, "x": 0, "y": 24 }, - "targets": [ - { "expr": "(1 - node_filesystem_avail_bytes{mountpoint=\"/\"} / node_filesystem_size_bytes{mountpoint=\"/\"}) * 100", "legendFormat": "Used %" } - ], - "fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100, "thresholds": { "steps": [{ "color": "green", "value": null }, { "color": "yellow", "value": 70 }, { "color": "red", "value": 85 }] } } } - }, - { - "title": "Host — CPU Usage", - "type": "timeseries", - "gridPos": { "h": 8, "w": 8, "x": 8, "y": 24 }, - "targets": [ - { "expr": "100 - (avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)", "legendFormat": "CPU %" } - ], - "fieldConfig": { "defaults": { "unit": "percent", "max": 100 } } - }, - { - "title": "Host — Memory Usage", - "type": "timeseries", - "gridPos": { "h": 8, "w": 8, "x": 16, "y": 24 }, - "targets": [ - { "expr": "node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes", "legendFormat": "Used" }, - { "expr": "node_memory_MemAvailable_bytes", "legendFormat": "Available" } - ], - "fieldConfig": { "defaults": { "unit": "bytes" } } - }, - { - "title": "Host — Network I/O", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 32 }, - "targets": [ - { "expr": "rate(node_network_receive_bytes_total{device!~\"lo|veth.*|br.*|docker.*\"}[5m])", "legendFormat": "{{device}} rx" }, - { "expr": "-rate(node_network_transmit_bytes_total{device!~\"lo|veth.*|br.*|docker.*\"}[5m])", "legendFormat": "{{device}} tx" } - ], - "fieldConfig": { "defaults": { "unit": "Bps" } } - }, - { - "title": "Host — Disk I/O", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 32 }, - "targets": [ - { "expr": "rate(node_disk_read_bytes_total[5m])", "legendFormat": "{{device}} read" }, - { "expr": "-rate(node_disk_written_bytes_total[5m])", "legendFormat": "{{device}} write" } - ], - "fieldConfig": { "defaults": { "unit": "Bps" } } - }, - { - "title": "BRouter — Request Latency (from Planner proxy)", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 40 }, - "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" }, - { "expr": "histogram_quantile(0.99, rate(brouter_request_duration_seconds_bucket[5m]))", "legendFormat": "p99" } - ], - "fieldConfig": { "defaults": { "unit": "s" } } - }, - { - "title": "Container — CPU Usage (all containers)", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 40 }, - "targets": [ - { "expr": "rate(container_cpu_usage_seconds_total{name=~\"trails-cool.*\"}[5m]) * 100", "legendFormat": "{{name}}" } - ], - "fieldConfig": { "defaults": { "unit": "percent" } } - }, - { - "title": "Container — Memory Usage (all containers)", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 48 }, - "targets": [ - { "expr": "container_memory_usage_bytes{name=~\"trails-cool.*\"}", "legendFormat": "{{name}}" } - ], - "fieldConfig": { "defaults": { "unit": "bytes" } } - }, - { - "title": "BRouter — Container Resources", - "type": "stat", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 48 }, - "targets": [ - { "expr": "container_memory_usage_bytes{name=~\".*brouter.*\"}", "legendFormat": "Memory" }, - { "expr": "rate(container_cpu_usage_seconds_total{name=~\".*brouter.*\"}[5m]) * 100", "legendFormat": "CPU %" } - ], - "fieldConfig": { "defaults": { "unit": "bytes" } } - }, - { - "title": "Caddy — Request Rate by Host", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 56 }, - "targets": [ - { "expr": "sum(rate(caddy_http_requests_total[5m])) by (server)", "legendFormat": "{{server}}" } - ] - }, - { - "title": "Caddy — Response Status Codes", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 56 }, - "targets": [ - { "expr": "sum(rate(caddy_http_responses_total[5m])) by (code)", "legendFormat": "{{code}}" } - ] - }, - { - "title": "Caddy — Request Duration by Host", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 0, "y": 64 }, - "targets": [ - { "expr": "histogram_quantile(0.95, sum(rate(caddy_http_request_duration_seconds_bucket[5m])) by (le, server))", "legendFormat": "p95 {{server}}" } - ], - "fieldConfig": { "defaults": { "unit": "s" } } - }, - { - "title": "Caddy — Active Connections", - "type": "timeseries", - "gridPos": { "h": 8, "w": 12, "x": 12, "y": 64 }, - "targets": [ - { "expr": "caddy_http_requests_in_flight", "legendFormat": "in-flight" } - ] + "targets": [ + { + "expr": "pg_database_size_bytes{datname=\"trails\"}", + "legendFormat": "trails" + } + ], + "fieldConfig": { + "defaults": { + "unit": "bytes" + } } - ] - } + }, + { + "title": "PostgreSQL \u2014 Transactions/sec", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 6, + "x": 18, + "y": 0 + }, + "targets": [ + { + "expr": "rate(pg_stat_database_xact_commit{datname=\"trails\"}[5m])", + "legendFormat": "commits/s" + }, + { + "expr": "rate(pg_stat_database_xact_rollback{datname=\"trails\"}[5m])", + "legendFormat": "rollbacks/s" + } + ] + }, + { + "title": "PostgreSQL \u2014 Slowest Queries (pg_stat_statements)", + "type": "table", + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 8 + }, + "targets": [ + { + "expr": "topk(10, pg_stat_statements_mean_time_seconds{datname=\"trails\"})", + "legendFormat": "{{query}}", + "format": "table", + "instant": true + } + ] + }, + { + "title": "PostgreSQL \u2014 Cache Hit Ratio", + "type": "gauge", + "gridPos": { + "h": 8, + "w": 6, + "x": 0, + "y": 16 + }, + "targets": [ + { + "expr": "pg_stat_database_blks_hit{datname=\"trails\"} / (pg_stat_database_blks_hit{datname=\"trails\"} + pg_stat_database_blks_read{datname=\"trails\"}) * 100", + "legendFormat": "hit %" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percent", + "min": 0, + "max": 100, + "thresholds": { + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "yellow", + "value": 90 + }, + { + "color": "green", + "value": 99 + } + ] + } + } + } + }, + { + "title": "PostgreSQL \u2014 Index Scans vs Sequential Scans", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 18, + "x": 6, + "y": 16 + }, + "targets": [ + { + "expr": "sum(rate(pg_stat_user_tables_idx_scan[5m]))", + "legendFormat": "Index scans/s" + }, + { + "expr": "sum(rate(pg_stat_user_tables_seq_scan[5m]))", + "legendFormat": "Sequential scans/s" + } + ] + }, + { + "title": "Host \u2014 Disk Usage", + "type": "gauge", + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 24 + }, + "targets": [ + { + "expr": "(1 - node_filesystem_avail_bytes{mountpoint=\"/\"} / node_filesystem_size_bytes{mountpoint=\"/\"}) * 100", + "legendFormat": "Used %" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percent", + "min": 0, + "max": 100, + "thresholds": { + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "yellow", + "value": 70 + }, + { + "color": "red", + "value": 85 + } + ] + } + } + } + }, + { + "title": "Host \u2014 CPU Usage", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 24 + }, + "targets": [ + { + "expr": "100 - (avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)", + "legendFormat": "CPU %" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percent", + "max": 100 + } + } + }, + { + "title": "Host \u2014 Memory Usage", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 24 + }, + "targets": [ + { + "expr": "node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes", + "legendFormat": "Used" + }, + { + "expr": "node_memory_MemAvailable_bytes", + "legendFormat": "Available" + } + ], + "fieldConfig": { + "defaults": { + "unit": "bytes" + } + } + }, + { + "title": "Host \u2014 Network I/O", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "targets": [ + { + "expr": "rate(node_network_receive_bytes_total{device!~\"lo|veth.*|br.*|docker.*\"}[5m])", + "legendFormat": "{{device}} rx" + }, + { + "expr": "-rate(node_network_transmit_bytes_total{device!~\"lo|veth.*|br.*|docker.*\"}[5m])", + "legendFormat": "{{device}} tx" + } + ], + "fieldConfig": { + "defaults": { + "unit": "Bps" + } + } + }, + { + "title": "Host \u2014 Disk I/O", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 32 + }, + "targets": [ + { + "expr": "rate(node_disk_read_bytes_total[5m])", + "legendFormat": "{{device}} read" + }, + { + "expr": "-rate(node_disk_written_bytes_total[5m])", + "legendFormat": "{{device}} write" + } + ], + "fieldConfig": { + "defaults": { + "unit": "Bps" + } + } + }, + { + "title": "BRouter \u2014 Request Latency (from Planner proxy)", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "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" + }, + { + "expr": "histogram_quantile(0.99, rate(brouter_request_duration_seconds_bucket[5m]))", + "legendFormat": "p99" + } + ], + "fieldConfig": { + "defaults": { + "unit": "s" + } + } + }, + { + "title": "Container \u2014 CPU Usage (all containers)", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 40 + }, + "targets": [ + { + "expr": "rate(container_cpu_usage_seconds_total{name=~\"trails-cool.*\"}[5m]) * 100", + "legendFormat": "{{name}}" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percent" + } + } + }, + { + "title": "Container \u2014 Memory Usage (all containers)", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 48 + }, + "targets": [ + { + "expr": "container_memory_usage_bytes{name=~\"trails-cool.*\"}", + "legendFormat": "{{name}}" + } + ], + "fieldConfig": { + "defaults": { + "unit": "bytes" + } + } + }, + { + "title": "BRouter \u2014 Container Resources", + "type": "stat", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 48 + }, + "targets": [ + { + "expr": "container_memory_usage_bytes{name=~\".*brouter.*\"}", + "legendFormat": "Memory" + }, + { + "expr": "rate(container_cpu_usage_seconds_total{name=~\".*brouter.*\"}[5m]) * 100", + "legendFormat": "CPU %" + } + ], + "fieldConfig": { + "defaults": { + "unit": "bytes" + } + } + }, + { + "title": "Caddy \u2014 Request Rate by Host", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 56 + }, + "targets": [ + { + "expr": "sum(rate(caddy_http_requests_total[5m])) by (server)", + "legendFormat": "{{server}}" + } + ] + }, + { + "title": "Caddy \u2014 Response Status Codes", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 56 + }, + "targets": [ + { + "expr": "sum(rate(caddy_http_responses_total[5m])) by (code)", + "legendFormat": "{{code}}" + } + ] + }, + { + "title": "Caddy \u2014 Request Duration by Host", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 64 + }, + "targets": [ + { + "expr": "histogram_quantile(0.95, sum(rate(caddy_http_request_duration_seconds_bucket[5m])) by (le, server))", + "legendFormat": "p95 {{server}}" + } + ], + "fieldConfig": { + "defaults": { + "unit": "s" + } + } + }, + { + "title": "Caddy \u2014 Active Connections", + "type": "timeseries", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 64 + }, + "targets": [ + { + "expr": "caddy_http_requests_in_flight", + "legendFormat": "in-flight" + } + ] + } + ] }