From 1a038bf27bd31c9cf68e98794794378049a083d8 Mon Sep 17 00:00:00 2001 From: Mahdi Darabi Date: Wed, 2 Dec 2026 03:41:42 +0330 Subject: [PATCH] feat(dashboard): redesign the Grafana dashboard around health and backup size The first row is now six status tiles (failed last jobs, not ready, stale, size drops, oldest success, no finished job) that show a green check at zero and turn amber or red with a count. Inventory counts follow, then one table row per CR with the size of the last stored object, the outcome timelines, a new backup size row (last stored object over time and each Backup's share of its 7-day maximum, the KArkiveBackupSizeDrop signal) and the duration and age trends with aging and stale bands. Colors carry one meaning each and pass 3:1 on both Grafana themes: blue Backup and orange Restore (validated for color-vision deficiency), green, amber and red only for status, gray for neutral counts. Every query keeps the label sets the chart's sourceLabel rewrite relies on. The landing page preview gains the size-drop tile, a last object column and the new alert. --- README.md | 2 + TODO.md | 1 + charts/karkive/dashboards/karkive.json | 2436 ++++++++++++++---------- docs/index.html | 12 +- docs/styles.css | 11 +- 5 files changed, 1440 insertions(+), 1022 deletions(-) diff --git a/README.md b/README.md index c7b3e5a..f8d03a2 100644 --- a/README.md +++ b/README.md @@ -471,6 +471,8 @@ Alerts (with `metrics.prometheusRule.enabled=true`): - CronJob has scheduled but no Job has finished - Missed CronJob schedule (needs kube-state-metrics) +The Grafana dashboard (`charts/karkive/dashboards/karkive.json`) opens with a health row (failed last jobs, not ready, stale, size drops, oldest success, no finished job) whose tiles show a green check at zero and turn amber or red with a count. Below it: inventory counts, one table row per CR (outcome, duration, success age, last stored object), job outcome timelines, backup size with each Backup's share of its 7-day maximum, and duration and age trends. Blue marks Backups and orange marks Restores everywhere; green, amber and red only mean status. Every color passes 3:1 contrast on both the light and dark Grafana themes. + When one Prometheus holds several KArkive installs (for example clusters sending remote_write with an external label), set `metrics.grafanaDashboard.sourceLabel` to the label that tells them apart (`cluster`, `k8s_cluster`, `region`; empty by default). The dashboard then gets a variable titled after the label and keeps it in every aggregation, so a Backup with the same name in two sources shows as two rows. Series without the label still show. `metrics.grafanaDashboard.folder` sets the Grafana sidecar folder. ## Webhooks diff --git a/TODO.md b/TODO.md index 187d695..c792d4e 100644 --- a/TODO.md +++ b/TODO.md @@ -85,6 +85,7 @@ - [x] Custom metrics per Backup/Restore (last success, duration, failures) - [x] Alerts for missed schedules and failed Jobs - [x] Grafana dashboard +- [x] Dashboard redesign: health row of status tiles (size drops and no-finished-job added), last stored object in the table, a backup size row (size over time and share of the 7-day max), and one color set that passes 3:1 on Grafana's light and dark themes (blue Backup, orange Restore, green/amber/red status only) ### MariaDB diff --git a/charts/karkive/dashboards/karkive.json b/charts/karkive/dashboards/karkive.json index 389594e..ebf7b2b 100644 --- a/charts/karkive/dashboards/karkive.json +++ b/charts/karkive/dashboards/karkive.json @@ -17,11 +17,96 @@ }, "editable": true, "fiscalYearStartMonth": 0, - "graphTooltip": 0, + "graphTooltip": 1, "id": null, - "links": [], + "links": [ + { + "title": "KArkive", + "type": "link", + "url": "https://karkive.ir", + "targetBlank": true, + "icon": "doc", + "tooltip": "Docs" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": [ + "karkive" + ], + "templating": { + "list": [ + { + "current": {}, + "includeAll": false, + "label": "Datasource", + "name": "datasource", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "type": "datasource" + }, + { + "allValue": ".*", + "current": { + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "definition": "label_values({__name__=~\"karkive_(backup|restore)_ready\"}, namespace)", + "includeAll": true, + "label": "Namespace", + "multi": true, + "name": "namespace", + "options": [], + "query": "label_values({__name__=~\"karkive_(backup|restore)_ready\"}, namespace)", + "refresh": 2, + "regex": "", + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "current": { + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "definition": "label_values({__name__=~\"karkive_(backup|restore)_ready\", namespace=~\"$namespace\"}, engine)", + "includeAll": true, + "label": "Engine", + "multi": true, + "name": "engine", + "options": [], + "query": "label_values({__name__=~\"karkive_(backup|restore)_ready\", namespace=~\"$namespace\"}, engine)", + "refresh": 2, + "regex": "", + "sort": 1, + "type": "query" + } + ] + }, + "time": { + "from": "now-24h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "KArkive", + "uid": "karkive", + "version": 11, "panels": [ { + "type": "row", + "title": "Health", + "id": 1, "collapsed": false, "gridPos": { "h": 1, @@ -29,464 +114,650 @@ "x": 0, "y": 0 }, - "id": 100, - "panels": [], - "title": "Overview", - "type": "row" + "panels": [] }, { + "type": "stat", + "title": "Failed last job", + "description": "Backups and Restores whose most recently finished Job failed (karkive_*_last_job_info outcome=Failed).", + "id": 2, "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "CRs whose last finished Job failed.", + "gridPos": { + "h": 5, + "w": 4, + "x": 0, + "y": 1 + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "(count(karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\",outcome=\"Failed\"}) or vector(0)) + (count(karkive_restore_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\",outcome=\"Failed\"}) or vector(0))", + "refId": "A", + "instant": true, + "range": false + } + ], "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "decimals": 0, - "mappings": [ - { - "options": { - "from": 0, - "result": { - "color": "semi-dark-green", - "index": 0 - }, - "to": 0 - }, - "type": "range" - }, - { - "options": { - "from": 1, - "result": { - "color": "#F2495C", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" - } - ], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ { - "color": "semi-dark-green", - "value": 0 + "color": "#14983a", + "value": null }, { - "color": "#F2495C", + "color": "#dc3c3d", "value": 1 } ] }, - "unit": "none" + "unit": "none", + "decimals": 0, + "noValue": "0", + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "✓ None failed", + "color": "#14983a", + "index": 0 + } + } + } + ] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 4, - "x": 0, - "y": 1 - }, - "id": 3, "options": { - "colorMode": "background", + "colorMode": "value", "graphMode": "none", "justifyMode": "center", "orientation": "auto", - "percentChangeColorMode": "standard", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + } + } + }, + { + "type": "stat", + "title": "Not ready", + "description": "CRs whose owned resources are not synced (phase is not Ready: missing Secret, source PVC or volume holder, invalid spec).", + "id": 3, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 5, + "w": 4, + "x": 4, + "y": 1 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "(count(karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\",outcome=\"Failed\"}) or vector(0)) + (count(karkive_restore_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\",outcome=\"Failed\"}) or vector(0))", - "legendFormat": "failed", - "refId": "A" + "expr": "(count(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"} == 0) or vector(0)) + (count(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"} == 0) or vector(0))", + "refId": "A", + "instant": true, + "range": false } ], - "title": "Last job failed", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Owned resources not Ready. This is not last Job success.", "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "decimals": 0, - "mappings": [ - { - "options": { - "from": 0, - "result": { - "color": "semi-dark-green", - "index": 0 - }, - "to": 0 - }, - "type": "range" - }, - { - "options": { - "from": 1, - "result": { - "color": "#F2495C", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" - } - ], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": 0 + "color": "#14983a", + "value": null }, { - "color": "#F2495C", + "color": "#dc3c3d", "value": 1 } ] }, - "unit": "none" + "unit": "none", + "decimals": 0, + "noValue": "0", + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "✓ All synced", + "color": "#14983a", + "index": 0 + } + } + } + ] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 4, - "x": 4, - "y": 1 - }, - "id": 16, "options": { - "colorMode": "background", + "colorMode": "value", "graphMode": "none", "justifyMode": "center", "orientation": "auto", - "percentChangeColorMode": "standard", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + } + } + }, + { + "type": "stat", + "title": "Stale backups", + "description": "Unsuspended Backups with no success in 36h (alert KArkiveBackupStale).", + "id": 4, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 5, + "w": 4, + "x": 8, + "y": 1 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "(count(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"} == 0) or vector(0)) + (count(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"} == 0) or vector(0))", - "legendFormat": "not ready", - "refId": "A" + "expr": "count((time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"} > 129600) and (karkive_backup_suspended{namespace=~\"$namespace\",engine=~\"$engine\"} == 0)) or vector(0)", + "refId": "A", + "instant": true, + "range": false } ], - "title": "Not ready", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Non-suspended Backups with no success in 36h (default stale alert).", "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#14983a", + "value": null + }, + { + "color": "#dc3c3d", + "value": 1 + } + ] + }, + "unit": "none", "decimals": 0, + "noValue": "0", "mappings": [ { + "type": "value", "options": { - "from": 0, - "result": { - "color": "semi-dark-green", + "0": { + "text": "✓ All fresh", + "color": "#14983a", "index": 0 - }, - "to": 0 - }, - "type": "range" - }, - { - "options": { - "from": 1, - "result": { - "color": "#F2495C", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" + } + } } + ] + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, + "reduceOptions": { + "calcs": [ + "lastNotNull" ], - "noValue": "0", + "fields": "", + "values": false + } + } + }, + { + "type": "stat", + "title": "Size drops", + "description": "Backups whose last stored object is below half the largest one of the last 7 days (alert KArkiveBackupSizeDrop): often an empty or partial dump. Stream Backups only.", + "id": 5, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 5, + "w": 4, + "x": 12, + "y": 1 + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "count(karkive_backup_last_size_bytes{namespace=~\"$namespace\",engine=~\"$engine\"} < 0.5 * max_over_time(karkive_backup_last_size_bytes{namespace=~\"$namespace\",engine=~\"$engine\"}[7d])) or vector(0)", + "refId": "A", + "instant": true, + "range": false + } + ], + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, "thresholds": { "mode": "absolute", "steps": [ { - "color": "semi-dark-green", - "value": 0 + "color": "#14983a", + "value": null }, { - "color": "#F2495C", + "color": "#bf7a00", "value": 1 } ] }, - "unit": "none" + "unit": "none", + "decimals": 0, + "noValue": "0", + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "✓ Sizes steady", + "color": "#14983a", + "index": 0 + } + } + } + ] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 4, - "x": 8, - "y": 1 - }, - "id": 17, "options": { - "colorMode": "background", + "colorMode": "value", "graphMode": "none", "justifyMode": "center", "orientation": "auto", - "percentChangeColorMode": "standard", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + } + } + }, + { + "type": "stat", + "title": "Oldest backup success", + "description": "Age of the oldest last success among unsuspended Backups. Amber past 8h (KArkiveBackupAging), red past 36h (KArkiveBackupStale).", + "id": 6, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 5, + "w": 4, + "x": 16, + "y": 1 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "count((time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"} > 129600) and (karkive_backup_suspended{namespace=~\"$namespace\",engine=~\"$engine\"} == 0)) or vector(0)", - "legendFormat": "stale", - "refId": "A" + "expr": "max((time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) and (karkive_backup_suspended{namespace=~\"$namespace\",engine=~\"$engine\"} == 0))", + "refId": "A", + "instant": true, + "range": false } ], - "title": "Stale backups", - "transparent": true, - "type": "stat" + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#14983a", + "value": null + }, + { + "color": "#bf7a00", + "value": 28800 + }, + { + "color": "#dc3c3d", + "value": 129600 + } + ] + }, + "unit": "s", + "decimals": 1, + "noValue": "—", + "mappings": [] + }, + "overrides": [] + }, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + } + } }, { + "type": "stat", + "title": "No finished job", + "description": "CRs whose CronJob has not finished a Job yet (alerts KArkiveBackupNoFinishedJob / KArkiveRestoreNoFinishedJob once it has scheduled).", + "id": 7, "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "CRs whose last finished Job succeeded.", + "gridPos": { + "h": 5, + "w": 4, + "x": 20, + "y": 1 + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "(count(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"} unless ignoring(outcome,reason,job_name) karkive_backup_last_job_info) or vector(0)) + (count(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"} unless ignoring(outcome,reason,job_name) karkive_restore_last_job_info) or vector(0))", + "refId": "A", + "instant": true, + "range": false + } + ], "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "decimals": 0, - "mappings": [ - { - "options": { - "from": 0, - "result": { - "color": "#FF9830", - "index": 0 - }, - "to": 0 - }, - "type": "range" - }, - { - "options": { - "from": 1, - "result": { - "color": "semi-dark-green", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" - } - ], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ { - "color": "#FF9830", - "value": 0 + "color": "#14983a", + "value": null }, { - "color": "semi-dark-green", + "color": "#bf7a00", "value": 1 } ] }, - "unit": "none" + "unit": "none", + "decimals": 0, + "noValue": "0", + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "✓ All have run", + "color": "#14983a", + "index": 0 + } + } + } + ] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 4, - "x": 12, - "y": 1 - }, - "id": 8, "options": { - "colorMode": "background", + "colorMode": "value", "graphMode": "none", "justifyMode": "center", "orientation": "auto", - "percentChangeColorMode": "standard", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + } + } + }, + { + "type": "stat", + "title": "Backups", + "description": "Backup CRs in scope, and how many are Ready.", + "id": 8, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 0, + "y": 6 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "(count(karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\",outcome=\"Succeeded\"}) or vector(0)) + (count(karkive_restore_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\",outcome=\"Succeeded\"}) or vector(0))", - "legendFormat": "succeeded", - "refId": "A" + "expr": "sum(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", + "refId": "A", + "legendFormat": "Ready", + "instant": true, + "range": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "count(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", + "refId": "B", + "legendFormat": "Total", + "instant": true, + "range": false } ], - "title": "Last job succeeded", - "transparent": true, - "type": "stat" + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#257de0", + "value": null + } + ] + }, + "unit": "none", + "decimals": 0, + "noValue": "0", + "mappings": [] + }, + "overrides": [] + }, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "center", + "orientation": "horizontal", + "textMode": "value_and_name", + "wideLayout": true, + "showPercentChange": false, + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + } + } }, { + "type": "stat", + "title": "Restores", + "description": "Restore CRs in scope, and how many are Ready.", + "id": 9, "datasource": { "type": "prometheus", "uid": "${datasource}" }, + "gridPos": { + "h": 4, + "w": 5, + "x": 5, + "y": 6 + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "sum(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", + "refId": "A", + "legendFormat": "Ready", + "instant": true, + "range": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "count(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", + "refId": "B", + "legendFormat": "Total", + "instant": true, + "range": false + } + ], "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "decimals": 0, - "mappings": [ - { - "options": { - "0": { - "color": "semi-dark-green", - "index": 0 - } - }, - "type": "value" - }, - { - "options": { - "from": 1, - "result": { - "color": "#FF9830", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" - } - ], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ { - "color": "semi-dark-green", - "value": 0 + "color": "#e0621f", + "value": null } ] }, - "unit": "none" + "unit": "none", + "decimals": 0, + "noValue": "0", + "mappings": [] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 4, - "x": 16, - "y": 1 - }, - "id": 9, "options": { - "colorMode": "background", + "colorMode": "none", "graphMode": "none", "justifyMode": "center", - "orientation": "auto", - "percentChangeColorMode": "standard", + "orientation": "horizontal", + "textMode": "value_and_name", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + } + } + }, + { + "type": "stat", + "title": "Suspended", + "description": "CRs with spec.suspend: true. Gray, not a problem; the age alerts skip suspended Backups.", + "id": 10, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 10, + "y": 6 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { @@ -494,316 +765,309 @@ "uid": "${datasource}" }, "expr": "(sum(karkive_backup_suspended{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)) + (sum(karkive_restore_suspended{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0))", - "legendFormat": "suspended", - "refId": "A" + "refId": "A", + "instant": true, + "range": false } ], - "title": "Suspended", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Oldest last-success among non-suspended Backups. Orange after 8h, red after 36h.", "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "mappings": [], - "noValue": "\u2014", "thresholds": { "mode": "absolute", "steps": [ { - "color": "semi-dark-green", - "value": 0 - }, - { - "color": "#FF9830", - "value": 28800 - }, - { - "color": "#F2495C", - "value": 129600 + "color": "#858d9c", + "value": null } ] }, - "unit": "s" + "unit": "none", + "decimals": 0, + "noValue": "0", + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "None", + "index": 0 + } + } + } + ] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 4, - "x": 20, - "y": 1 - }, - "id": 4, "options": { - "colorMode": "background", + "colorMode": "none", "graphMode": "none", "justifyMode": "center", "orientation": "auto", - "percentChangeColorMode": "standard", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + } + } + }, + { + "type": "stat", + "title": "Stored per run", + "description": "Sum of the last stored object of every Stream Backup in scope (status.lastObject): what one round of backups writes to S3.", + "id": 11, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 14, + "y": 6 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "max((time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) and (karkive_backup_suspended{namespace=~\"$namespace\",engine=~\"$engine\"} == 0)) or vector(0)", - "legendFormat": "age", - "refId": "A" + "expr": "sum(karkive_backup_last_size_bytes{namespace=~\"$namespace\",engine=~\"$engine\"})", + "refId": "A", + "instant": true, + "range": false } ], - "title": "Oldest backup success", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Ready means owned resources are synced.", "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "decimals": 0, - "mappings": [ - { - "options": { - "from": 0, - "result": { - "color": "#FFFFFF", - "index": 0 - }, - "to": 0 - }, - "type": "range" - }, - { - "options": { - "from": 1, - "result": { - "color": "semi-dark-green", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" - } - ], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ { - "color": "#FFFFFF", - "value": 0 - }, - { - "color": "semi-dark-green", - "value": 1 + "color": "#257de0", + "value": null } ] }, - "unit": "none" + "unit": "bytes", + "decimals": 1, + "noValue": "—", + "mappings": [] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 12, - "x": 0, - "y": 5 - }, - "id": 1, "options": { - "colorMode": "background", + "colorMode": "none", "graphMode": "none", "justifyMode": "center", "orientation": "auto", - "percentChangeColorMode": "standard", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], - "fields": "/^ready$/", + "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + } + } + }, + { + "type": "stat", + "title": "Slowest last job", + "description": "Longest wall time among the most recently finished Jobs in scope.", + "id": 12, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 19, + "y": 6 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", - "legendFormat": "ready", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "count(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", - "legendFormat": "total", - "refId": "B" + "expr": "max({__name__=~\"karkive_(backup|restore)_last_job_duration_seconds\",namespace=~\"$namespace\",engine=~\"$engine\"})", + "refId": "A", + "instant": true, + "range": false } ], - "title": "Backups ready", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Ready means owned resources are synced.", "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "decimals": 0, - "mappings": [ - { - "options": { - "from": 0, - "result": { - "color": "#FFFFFF", - "index": 0 - }, - "to": 0 - }, - "type": "range" - }, - { - "options": { - "from": 1, - "result": { - "color": "semi-dark-green", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" - } - ], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ { - "color": "#FFFFFF", - "value": 0 - }, - { - "color": "semi-dark-green", - "value": 1 + "color": "#858d9c", + "value": null } ] }, - "unit": "none" + "unit": "s", + "decimals": 1, + "noValue": "—", + "mappings": [] }, "overrides": [] }, - "gridPos": { - "h": 4, - "w": 12, - "x": 12, - "y": 5 - }, - "id": 2, "options": { - "colorMode": "background", + "colorMode": "none", "graphMode": "none", "justifyMode": "center", "orientation": "auto", - "percentChangeColorMode": "standard", + "textMode": "value", + "wideLayout": true, + "showPercentChange": false, "reduceOptions": { "calcs": [ "lastNotNull" ], - "fields": "/^ready$/", + "fields": "", "values": false - }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true - }, - "pluginVersion": "12.2.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "sum(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", - "legendFormat": "ready", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "count(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"}) or vector(0)", - "legendFormat": "total", - "refId": "B" } - ], - "title": "Restores ready", - "transparent": true, - "type": "stat" + } }, { + "type": "row", + "title": "Last jobs", + "id": 13, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 9 + "y": 10 }, - "id": 101, - "panels": [], - "title": "Jobs", - "type": "row" + "panels": [] }, { + "type": "table", + "title": "Last job per CR", + "id": 14, "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "Last finished Job for each Backup and Restore.", + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 11 + }, + "description": "One row per Backup or Restore: the most recently finished Job, its duration, the age of the last success and, for Stream Backups, the size of the last stored object. Failed rows sort first.", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace((karkive_backup_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Backup\", \"\", \"\")) or sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace((karkive_restore_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_restore_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Restore\", \"\", \"\"))", + "refId": "A", + "instant": true, + "range": false, + "format": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace((time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Backup\", \"\", \"\")) or sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace((time() - karkive_restore_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_restore_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Restore\", \"\", \"\"))", + "refId": "B", + "instant": true, + "range": false, + "format": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace(karkive_backup_last_size_bytes{namespace=~\"$namespace\",engine=~\"$engine\"} * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Backup\", \"\", \"\"))", + "refId": "C", + "instant": true, + "range": false, + "format": "table" + } + ], + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "__name__": true, + "container": true, + "endpoint": true, + "instance": true, + "job": true, + "pod": true, + "service": true + }, + "indexByName": { + "kind": 0, + "namespace": 1, + "name": 2, + "engine": 3, + "outcome": 4, + "Value #A": 5, + "Value #B": 6, + "Value #C": 7, + "reason": 8, + "job_name": 9 + }, + "renameByName": { + "kind": "Kind", + "namespace": "Namespace", + "name": "Name", + "engine": "Engine", + "outcome": "Outcome", + "reason": "Reason", + "job_name": "Job", + "Value #A": "Duration", + "Value #B": "Success age", + "Value #C": "Last object" + } + } + }, + { + "id": "sortBy", + "options": { + "fields": {}, + "sort": [ + { + "desc": false, + "field": "Outcome" + } + ] + } + } + ], "fieldConfig": { "defaults": { "custom": { @@ -812,67 +1076,104 @@ "type": "auto" }, "filterable": true, + "inspect": false, "footer": { "reducers": [ "countAll" ] - }, - "inspect": false + } }, - "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 + "color": "#858d9c", + "value": null } ] - } + }, + "mappings": [] }, "overrides": [ { "matcher": { "id": "byName", - "options": "Outcome" + "options": "Kind" }, "properties": [ + { + "id": "custom.width", + "value": 96 + }, { "id": "custom.cellOptions", "value": { "type": "color-text" } }, + { + "id": "mappings", + "value": [ + { + "type": "value", + "options": { + "Backup": { + "text": "▲ Backup", + "color": "#257de0", + "index": 0 + }, + "Restore": { + "text": "▼ Restore", + "color": "#e0621f", + "index": 1 + } + } + } + ] + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Outcome" + }, + "properties": [ { "id": "custom.width", - "value": 120 + "value": 132 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-background", + "mode": "basic", + "applyToRow": false, + "wrapText": false + } }, { "id": "mappings", "value": [ { + "type": "value", "options": { "Failed": { - "color": "red", - "index": 0, - "text": "Failed" + "text": "✕ Failed", + "color": "#dc3c3d", + "index": 0 }, "Succeeded": { - "color": "green", - "index": 1, - "text": "Succeeded" + "text": "✓ Succeeded", + "color": "#14983a", + "index": 1 }, "Unknown": { - "color": "orange", - "index": 2, - "text": "Unknown" + "text": "? Unknown", + "color": "#858d9c", + "index": 2 } - }, - "type": "value" + } } ] } @@ -922,67 +1223,87 @@ "type": "color-text" } }, + { + "id": "color", + "value": { + "mode": "thresholds" + } + }, { "id": "thresholds", "value": { "mode": "absolute", "steps": [ { - "color": "green", - "value": 0 + "color": "#14983a", + "value": null }, { - "color": "orange", + "color": "#bf7a00", "value": 28800 }, { - "color": "red", + "color": "#dc3c3d", "value": 129600 } ] } - }, - { - "id": "color", - "value": { - "mode": "thresholds" - } } ] }, { "matcher": { "id": "byName", - "options": "Kind" + "options": "Last object" }, "properties": [ + { + "id": "unit", + "value": "bytes" + }, + { + "id": "decimals", + "value": 1 + }, { "id": "custom.width", - "value": 90 + "value": 170 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "gauge", + "mode": "basic", + "valueDisplayMode": "text" + } + }, + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#257de0" + } + }, + { + "id": "noValue", + "value": "—" } ] }, { "matcher": { "id": "byName", - "options": "Engine" + "options": "Reason" }, "properties": [ { "id": "custom.width", - "value": 100 + "value": 170 } ] } ] }, - "gridPos": { - "h": 10, - "w": 20, - "x": 0, - "y": 10 - }, - "id": 7, "options": { "cellHeight": "sm", "showHeader": true, @@ -992,423 +1313,464 @@ "displayName": "Outcome" } ] + } + }, + { + "type": "row", + "title": "Job outcome over time", + "id": 15, + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 22 + }, + "panels": [] + }, + { + "type": "state-timeline", + "title": "Backups", + "id": 16, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 23 }, - "pluginVersion": "12.2.0", + "description": "Outcome of each Backup's most recently finished Job over the range. Gaps: no Job had finished yet.", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace(karkive_backup_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"} * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Backup\", \"\", \"\")) or sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace(karkive_restore_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"} * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_restore_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Restore\", \"\", \"\"))", - "format": "table", - "instant": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace((time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_backup_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Backup\", \"\", \"\")) or sum by (kind, namespace, name, engine, outcome, reason, job_name) (label_replace((time() - karkive_restore_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"}) * ignoring(outcome,reason,job_name) group_left(outcome,reason,job_name) karkive_restore_last_job_info{namespace=~\"$namespace\",engine=~\"$engine\"}, \"kind\", \"Restore\", \"\", \"\"))", - "format": "table", - "instant": true, - "refId": "B" - } - ], - "title": "Last job", - "transformations": [ - { - "id": "merge", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Time": true, - "__name__": true, - "container": true, - "endpoint": true, - "instance": true, - "job": true, - "pod": true, - "service": true - }, - "indexByName": { - "Value #A": 7, - "Value #B": 8, - "engine": 3, - "job_name": 6, - "kind": 0, - "name": 2, - "namespace": 1, - "outcome": 4, - "reason": 5 - }, - "renameByName": { - "Value #A": "Duration", - "Value #B": "Success age", - "engine": "Engine", - "job_name": "Job", - "kind": "Kind", - "name": "Name", - "namespace": "Namespace", - "outcome": "Outcome", - "reason": "Reason" - } - } - }, - { - "id": "sortBy", - "options": { - "fields": {}, - "sort": [ - { - "desc": false, - "field": "Outcome" - } - ] - } + "expr": "max by (kind, name, engine) (label_replace(karkive_backup_last_job_failed{namespace=~\"$namespace\",engine=~\"$engine\"} and ignoring(outcome,reason,job_name) karkive_backup_last_job_info, \"kind\", \"Backup\", \"\", \"\"))", + "refId": "A", + "legendFormat": "{{name}}" } ], - "transparent": true, - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "CRs that have never finished a Job. 0 when every CR has a last job.", "fieldConfig": { "defaults": { "color": { - "fixedColor": "#73BF69", "mode": "thresholds" }, - "decimals": 0, - "mappings": [ - { - "options": { - "from": 0, - "result": { - "color": "semi-dark-green", - "index": 0 - }, - "to": 0 - }, - "type": "range" - }, - { - "options": { - "from": 1, - "result": { - "color": "#FF9830", - "index": 1 - }, - "to": 1000000000000 - }, - "type": "range" - } - ], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ { - "color": "semi-dark-green", - "value": 0 + "color": "#14983a", + "value": null }, { - "color": "#FF9830", + "color": "#dc3c3d", "value": 1 } ] }, - "unit": "none" + "custom": { + "fillOpacity": 85, + "lineWidth": 0, + "insertNulls": false, + "spanNulls": false, + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "✓ Succeeded", + "color": "#14983a", + "index": 0 + }, + "1": { + "text": "✕ Failed", + "color": "#dc3c3d", + "index": 1 + } + } + } + ] }, "overrides": [] }, - "gridPos": { - "h": 10, - "w": 4, - "x": 20, - "y": 10 - }, - "id": 14, "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "center", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false + "alignValue": "center", + "mergeValues": true, + "rowHeight": 0.72, + "showValue": "never", + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "showPercentChange": false, - "textMode": "value", - "wideLayout": true + "tooltip": { + "mode": "single", + "sort": "none", + "hideZeros": false + } + } + }, + { + "type": "state-timeline", + "title": "Restores", + "id": 17, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 23 }, - "pluginVersion": "12.2.0", + "description": "Outcome of each Restore's most recently finished Job over the range. Gaps: no Job had finished yet.", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "(count(karkive_backup_ready{namespace=~\"$namespace\",engine=~\"$engine\"} unless ignoring(outcome,reason,job_name) karkive_backup_last_job_info) or vector(0)) + (count(karkive_restore_ready{namespace=~\"$namespace\",engine=~\"$engine\"} unless ignoring(outcome,reason,job_name) karkive_restore_last_job_info) or vector(0))", - "legendFormat": "none", - "refId": "A" + "expr": "max by (kind, name, engine) (label_replace(karkive_restore_last_job_failed{namespace=~\"$namespace\",engine=~\"$engine\"} and ignoring(outcome,reason,job_name) karkive_restore_last_job_info, \"kind\", \"Restore\", \"\", \"\"))", + "refId": "A", + "legendFormat": "{{name}}" } ], - "title": "No finished job", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Last finished Job per Backup CR. Green is Succeeded, red is Failed. CRs with no finished Job are omitted.", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#14983a", + "value": null + }, + { + "color": "#dc3c3d", + "value": 1 + } + ] + }, "custom": { - "axisPlacement": "auto", - "fillOpacity": 100, + "fillOpacity": 85, + "lineWidth": 0, + "insertNulls": false, + "spanNulls": false, "hideFrom": { "legend": false, "tooltip": false, "viz": false - }, - "insertNulls": false, - "lineWidth": 0, - "spanNulls": false + } }, "mappings": [ { + "type": "value", "options": { "0": { - "color": "dark-green", - "index": 0, - "text": "Succeeded" + "text": "✓ Succeeded", + "color": "#14983a", + "index": 0 }, "1": { - "color": "red", - "index": 1, - "text": "Failed" + "text": "✕ Failed", + "color": "#dc3c3d", + "index": 1 } - }, - "type": "value" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "semi-dark-green", - "value": 0 - }, - { - "color": "red", - "value": 1 } - ] - } + } + ] }, "overrides": [] }, - "gridPos": { - "h": 12, - "w": 12, - "x": 0, - "y": 20 - }, - "id": 13, "options": { "alignValue": "center", + "mergeValues": true, + "rowHeight": 0.72, + "showValue": "never", "legend": { - "displayMode": "hidden", + "displayMode": "list", "placement": "bottom", - "showLegend": false + "showLegend": true }, - "mergeValues": true, - "rowHeight": 0.8, - "showValue": "never", "tooltip": { - "hideZeros": false, "mode": "single", - "sort": "none" + "sort": "none", + "hideZeros": false } + } + }, + { + "type": "row", + "title": "Backup size", + "id": 18, + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 33 + }, + "panels": [] + }, + { + "type": "timeseries", + "title": "Last stored object", + "description": "Size of the object each Stream Backup stored on its last successful run (status.lastObject). A step down is a smaller dump; see the drop ratio panel.", + "id": 19, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 9, + "w": 16, + "x": 0, + "y": 34 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "max by (kind, name, engine) (label_replace(karkive_backup_last_job_failed{namespace=~\"$namespace\",engine=~\"$engine\"} and ignoring(outcome,reason,job_name) karkive_backup_last_job_info, \"kind\", \"Backup\", \"\", \"\"))", - "legendFormat": "{{name}}", - "refId": "A" + "expr": "max by (name, namespace) (karkive_backup_last_size_bytes{namespace=~\"$namespace\",engine=~\"$engine\"})", + "refId": "A", + "legendFormat": "{{name}}" } ], - "title": "Backup last job over time", - "transparent": true, - "type": "state-timeline" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Last finished Job per Restore CR. Green is Succeeded, red is Failed. CRs with no finished Job are omitted.", "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" }, "custom": { + "drawStyle": "line", + "lineInterpolation": "stepAfter", + "lineWidth": 2, + "fillOpacity": 6, + "gradientMode": "opacity", + "showPoints": "auto", + "pointSize": 6, + "spanNulls": true, + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisPlacement": "auto", - "fillOpacity": 100, + "axisSoftMin": 0, + "barAlignment": 0, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, "insertNulls": false, - "lineWidth": 0, - "spanNulls": false - }, - "mappings": [ - { - "options": { - "0": { - "color": "dark-green", - "index": 0, - "text": "Succeeded" - }, - "1": { - "color": "red", - "index": 1, - "text": "Failed" - } - }, - "type": "value" + "scaleDistribution": { + "type": "linear" + }, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" } - ], + }, + "unit": "bytes", "thresholds": { "mode": "absolute", "steps": [ { - "color": "semi-dark-green", - "value": 0 - }, - { - "color": "red", - "value": 1 + "color": "transparent", + "value": null } ] } }, "overrides": [] }, - "gridPos": { - "h": 12, - "w": 12, - "x": 12, - "y": 20 - }, - "id": 18, "options": { - "alignValue": "center", "legend": { - "displayMode": "hidden", + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "table", "placement": "bottom", - "showLegend": false + "showLegend": true, + "sortBy": "Last *", + "sortDesc": true }, - "mergeValues": true, - "rowHeight": 0.8, - "showValue": "never", "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc", + "hideZeros": false } + } + }, + { + "type": "bargauge", + "title": "Size vs 7-day max", + "id": 20, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 16, + "y": 34 }, - "pluginVersion": "12.2.0", + "description": "Last stored object as a share of the largest one in 7 days. Amber below 50%: KArkiveBackupSizeDrop fires after 15 minutes there.", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "max by (kind, name, engine) (label_replace(karkive_restore_last_job_failed{namespace=~\"$namespace\",engine=~\"$engine\"} and ignoring(outcome,reason,job_name) karkive_restore_last_job_info, \"kind\", \"Restore\", \"\", \"\"))", + "expr": "max by (name, namespace) (karkive_backup_last_size_bytes{namespace=~\"$namespace\",engine=~\"$engine\"}) / max by (name, namespace) (max_over_time(karkive_backup_last_size_bytes{namespace=~\"$namespace\",engine=~\"$engine\"}[7d]))", + "refId": "A", "legendFormat": "{{name}}", - "refId": "A" + "instant": true, + "range": false } ], - "title": "Restore last job over time", - "transparent": true, - "type": "state-timeline" + "fieldConfig": { + "defaults": { + "unit": "percentunit", + "min": 0, + "max": 1, + "decimals": 0, + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#bf7a00", + "value": null + }, + { + "color": "#14983a", + "value": 0.5 + } + ] + } + }, + "overrides": [] + }, + "options": { + "displayMode": "basic", + "orientation": "horizontal", + "showUnfilled": true, + "valueMode": "color", + "namePlacement": "left", + "sizing": "auto", + "minVizHeight": 14, + "maxVizHeight": 22, + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "legend": { + "showLegend": false + } + } }, { + "type": "row", + "title": "Trends", + "id": 21, "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 32 + "y": 43 }, - "id": 102, - "panels": [], - "title": "Trends", - "type": "row" + "panels": [] }, { + "type": "timeseries", + "title": "Last job duration", + "description": "Wall time of the most recently finished Job per CR. Blue: Backups, orange: Restores.", + "id": 22, "datasource": { "type": "prometheus", "uid": "${datasource}" }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 44 + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "max by (name, engine) (karkive_backup_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", + "refId": "A", + "legendFormat": "▲ {{name}}" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "max by (name, engine) (karkive_restore_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", + "refId": "B", + "legendFormat": "▼ {{name}}" + } + ], "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "drawStyle": "line", + "lineInterpolation": "stepAfter", + "lineWidth": 2, + "fillOpacity": 6, + "gradientMode": "opacity", + "showPoints": "never", + "pointSize": 6, + "spanNulls": true, "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", - "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 8, - "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 2, - "pointSize": 5, "scaleDistribution": { "type": "linear" }, - "showPoints": "never", - "showValues": false, - "spanNulls": true, "stacking": { "group": "A", "mode": "none" @@ -1417,31 +1779,50 @@ "mode": "off" } }, - "mappings": [], + "unit": "s", "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": 0 - }, + "color": "transparent", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byFrameRefID", + "options": "A" + }, + "properties": [ { - "color": "red", - "value": 80 + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#257de0" + } } ] }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 33 + { + "matcher": { + "id": "byFrameRefID", + "options": "B" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#e0621f" + } + } + ] + } + ] }, - "id": 5, "options": { "legend": { "calcs": [ @@ -1450,186 +1831,227 @@ ], "displayMode": "table", "placement": "bottom", - "showLegend": true + "showLegend": true, + "sortBy": "Last *", + "sortDesc": true }, "tooltip": { - "hideZeros": false, "mode": "multi", - "sort": "desc" + "sort": "desc", + "hideZeros": false } + } + }, + { + "type": "timeseries", + "title": "Time since last success", + "description": "Age of the last successful Job per CR. Bands: amber past 8h (aging), red past 36h (stale).", + "id": 23, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 44 }, - "pluginVersion": "12.2.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "max by (name, engine) (karkive_backup_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", - "legendFormat": "Backup {{name}}", - "refId": "A" + "expr": "max by (name, engine) (time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", + "refId": "A", + "legendFormat": "▲ {{name}}" }, { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "max by (name, engine) (karkive_restore_last_job_duration_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", - "legendFormat": "Restore {{name}}", - "refId": "B" + "expr": "max by (name, engine) (time() - karkive_restore_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", + "refId": "B", + "legendFormat": "▼ {{name}}" } ], - "title": "Last job duration", - "transparent": true, - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Dashed line is the 36h stale-backup alert.", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 2, + "fillOpacity": 0, + "gradientMode": "opacity", + "showPoints": "never", + "pointSize": 6, + "spanNulls": true, "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", - "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 8, - "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 2, - "pointSize": 5, "scaleDistribution": { "type": "linear" }, - "showPoints": "never", - "showValues": false, - "spanNulls": true, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { - "mode": "line" + "mode": "area" } }, - "mappings": [], + "unit": "s", "thresholds": { "mode": "absolute", "steps": [ { "color": "transparent", - "value": 0 + "value": null + }, + { + "color": "rgba(191, 122, 0, 0.10)", + "value": 28800 }, { - "color": "orange", + "color": "rgba(220, 60, 61, 0.12)", "value": 129600 } ] - }, - "unit": "s" + } }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 33 + "overrides": [ + { + "matcher": { + "id": "byFrameRefID", + "options": "A" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#257de0" + } + } + ] + }, + { + "matcher": { + "id": "byFrameRefID", + "options": "B" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#e0621f" + } + } + ] + } + ] }, - "id": 10, "options": { "legend": { "calcs": [ - "lastNotNull" + "lastNotNull", + "max" ], "displayMode": "table", "placement": "bottom", - "showLegend": true + "showLegend": true, + "sortBy": "Last *", + "sortDesc": true }, "tooltip": { - "hideZeros": false, "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "12.2.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "max by (name, engine) (time() - karkive_backup_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", - "legendFormat": "Backup {{name}}", - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "max by (name, engine) (time() - karkive_restore_last_successful_timestamp_seconds{namespace=~\"$namespace\",engine=~\"$engine\"})", - "legendFormat": "Restore {{name}}", - "refId": "B" + "sort": "desc", + "hideZeros": false } - ], - "title": "Time since last success", - "transparent": true, - "type": "timeseries" + } }, { + "type": "row", + "title": "Operator", + "id": 26, "collapsed": true, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 41 + "y": 53 }, - "id": 103, "panels": [ { + "type": "timeseries", + "title": "Reconcile errors", + "description": "Reconcile() returning an error. Operator-loop health, not Job failure. Not filtered by the CR namespace.", + "id": 24, "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "Reconcile() returning an error. This is operator-loop health, not Job failure. Not filtered by the CR namespace.", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 54 + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "sum by (controller) (rate(controller_runtime_reconcile_errors_total{controller=~\"backup|restore\"}[5m]))", + "refId": "A", + "legendFormat": "{{controller}}" + } + ], "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 2, + "fillOpacity": 6, + "gradientMode": "opacity", + "showPoints": "never", + "pointSize": 6, + "spanNulls": true, "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", - "drawStyle": "line", - "fillOpacity": 8, - "gradientMode": "none", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, - "lineInterpolation": "smooth", - "lineWidth": 2, - "showPoints": "never", - "spanNulls": true, + "insertNulls": false, + "scaleDistribution": { + "type": "linear" + }, "stacking": { "group": "A", "mode": "none" @@ -1638,29 +2060,50 @@ "mode": "off" } }, + "unit": "ops", "thresholds": { "mode": "absolute", "steps": [ { - "color": "green" - }, + "color": "transparent", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "^backup" + }, + "properties": [ { - "color": "red", - "value": 0.01 + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#257de0" + } } ] }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 42 + { + "matcher": { + "id": "byRegexp", + "options": "^restore" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#e0621f" + } + } + ] + } + ] }, - "id": 6, "options": { "legend": { "calcs": [ @@ -1669,12 +2112,31 @@ ], "displayMode": "table", "placement": "bottom", - "showLegend": true + "showLegend": true, + "sortBy": "Last *", + "sortDesc": true }, "tooltip": { "mode": "multi", - "sort": "desc" + "sort": "desc", + "hideZeros": false } + } + }, + { + "type": "timeseries", + "title": "Reconcile rate", + "description": "Reconciles per second by controller. Not filtered by the CR namespace.", + "id": 25, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 54 }, "targets": [ { @@ -1682,42 +2144,40 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum by (controller) (rate(controller_runtime_reconcile_errors_total{controller=~\"backup|restore\"}[5m]))", - "legendFormat": "{{controller}}", - "refId": "A" + "expr": "sum by (controller) (rate(controller_runtime_reconcile_total{controller=~\"backup|restore\"}[5m]))", + "refId": "A", + "legendFormat": "{{controller}}" } ], - "title": "Reconcile errors", - "transparent": true, - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Reconcile throughput. Not filtered by the CR namespace.", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "drawStyle": "line", + "lineInterpolation": "smooth", + "lineWidth": 2, + "fillOpacity": 6, + "gradientMode": "opacity", + "showPoints": "never", + "pointSize": 6, + "spanNulls": true, "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", - "drawStyle": "line", - "fillOpacity": 8, - "gradientMode": "none", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, - "lineInterpolation": "smooth", - "lineWidth": 2, - "showPoints": "never", - "spanNulls": true, + "insertNulls": false, + "scaleDistribution": { + "type": "linear" + }, "stacking": { "group": "A", "mode": "none" @@ -1726,123 +2186,71 @@ "mode": "off" } }, - "unit": "ops" + "unit": "ops", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "transparent", + "value": null + } + ] + } }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 42 + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "^backup" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#257de0" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "^restore" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "#e0621f" + } + } + ] + } + ] }, - "id": 15, "options": { "legend": { "calcs": [ "lastNotNull", - "mean" + "max" ], "displayMode": "table", "placement": "bottom", - "showLegend": true + "showLegend": true, + "sortBy": "Last *", + "sortDesc": true }, "tooltip": { "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "sum by (controller) (rate(controller_runtime_reconcile_total{controller=~\"backup|restore\"}[5m]))", - "legendFormat": "{{controller}}", - "refId": "A" + "sort": "desc", + "hideZeros": false } - ], - "title": "Reconcile rate", - "transparent": true, - "type": "timeseries" + } } - ], - "title": "Operator", - "type": "row" + ] } ], - "refresh": "30s", - "schemaVersion": 42, - "tags": [ - "karkive" - ], - "templating": { - "list": [ - { - "current": {}, - "includeAll": false, - "label": "Datasource", - "name": "datasource", - "options": [], - "query": "prometheus", - "refresh": 1, - "regex": "", - "type": "datasource" - }, - { - "allValue": ".*", - "current": { - "text": "All", - "value": "$__all" - }, - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "definition": "label_values({__name__=~\"karkive_(backup|restore)_ready\"}, namespace)", - "includeAll": true, - "label": "Namespace", - "multi": true, - "name": "namespace", - "options": [], - "query": "label_values({__name__=~\"karkive_(backup|restore)_ready\"}, namespace)", - "refresh": 2, - "regex": "", - "sort": 1, - "type": "query" - }, - { - "allValue": ".*", - "current": { - "text": "All", - "value": "$__all" - }, - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "definition": "label_values({__name__=~\"karkive_(backup|restore)_ready\", namespace=~\"$namespace\"}, engine)", - "includeAll": true, - "label": "Engine", - "multi": true, - "name": "engine", - "options": [], - "query": "label_values({__name__=~\"karkive_(backup|restore)_ready\", namespace=~\"$namespace\"}, engine)", - "refresh": 2, - "regex": "", - "sort": 1, - "type": "query" - } - ] - }, - "time": { - "from": "now-24h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "KArkive", - "uid": "karkive", - "version": 10 + "description": "KArkive Backups and Restores: health, last jobs, stored object sizes and trends. Blue is Backup, orange is Restore; green, amber and red are status." } diff --git a/docs/index.html b/docs/index.html index 33a35d6..62abfb1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -355,7 +355,7 @@

PVC files

Observability

Know the state of every archive.

-

Prometheus metrics per namespace, name and engine. The chart can install a ServiceMonitor, alert rules and this Grafana dashboard. One Prometheus for many clusters? Name the label that tells them apart and the dashboard keeps them apart.

+

Prometheus metrics per namespace, name and engine, including the size of every stored dump. The chart can install a ServiceMonitor, alert rules and this Grafana dashboard. One Prometheus for many clusters? Name the label that tells them apart and the dashboard keeps them apart.

@@ -377,6 +377,7 @@

Know the state of every archive.

Restores ready3 / 3✓ synced
Last job failed0✓ healthy
Stale backups0✓ within 36h
+
Size drops0✓ sizes steady
Suspended2⏸ by spec
@@ -395,10 +396,10 @@

Know the state of every archive.

Last jobsample data
-
Kind / nameEngineOutcomeDurationSuccess age
-
Backup app-postgrespostgres✓ Succeeded42s2h 14m
-
Backup cache-redisredis✓ Succeeded8s5h 02m
-
Restore staging-dbmariadb✓ Succeeded61s19h 41m
+
Kind / nameEngineOutcomeDurationSuccess ageLast object
+
Backup app-postgrespostgres✓ Succeeded42s2h 14m1.6 GiB
+
Backup cache-redisredis✓ Succeeded8s5h 02m231 MiB
+
Restore staging-dbmariadb✓ Succeeded61s19h 41m—
@@ -414,6 +415,7 @@

Alerts included

  • CR not Ready for 15 minutes
  • Last Job failed
  • Backup aging (8h) or stale (36h)
  • +
  • Backup much smaller than last week (empty or partial dump)
  • CronJob scheduled but no Job finished
  • Missed CronJob schedule
  • diff --git a/docs/styles.css b/docs/styles.css index 9dac285..58588c6 100644 --- a/docs/styles.css +++ b/docs/styles.css @@ -907,7 +907,7 @@ pre .c { .dash-stats { display: grid; - grid-template-columns: repeat(5, minmax(0, 1fr)); + grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 0.6rem; } @@ -1136,7 +1136,7 @@ pre .c { .job-row { display: grid; - grid-template-columns: 1.6fr 1fr 1fr 0.7fr 0.9fr; + grid-template-columns: 1.6fr 0.9fr 1fr 0.7fr 0.9fr 0.9fr; gap: 0.75rem; padding: 0.55rem 0; border-top: 1px solid var(--line); @@ -1160,6 +1160,10 @@ pre .c { color: var(--ok); } +.job-row .dim { + color: var(--dim); +} + .chart-data { margin-top: 0.6rem; color: var(--muted); @@ -1449,7 +1453,8 @@ pre .c { } .job-row > :nth-child(2), - .job-row > :nth-child(5) { + .job-row > :nth-child(5), + .job-row > :nth-child(6) { display: none; } }