From 2c5ee7757fa939ac3c996eaeb0584bc9cd6c7c94 Mon Sep 17 00:00:00 2001 From: anant-shipit Date: Fri, 17 Jul 2026 18:41:11 +0530 Subject: [PATCH 1/2] feat(dashboard): set Feed Expiration visualization to Bar Gauge (Fixes #98) --- .../watchdog_metrics_dashboard.json | 51 ++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/grafana/dashboards/watchdog_metrics_dashboard.json b/grafana/dashboards/watchdog_metrics_dashboard.json index 9929e794..2009b2d8 100644 --- a/grafana/dashboards/watchdog_metrics_dashboard.json +++ b/grafana/dashboards/watchdog_metrics_dashboard.json @@ -171,7 +171,35 @@ "datasource": { "name": "Prometheus" }, - "description": "Metrics: gtfs_bundle_days_until_earliest_expiration, gtfs_bundle_days_until_latest_expiration\nQuestion answered: \"Are GTFS bundles approaching expiration?\"", + "description": "Metrics: gtfs_bundle_days_until_earliest_expiration, gtfs_bundle_days_until_latest_expiration\nQuestion answered: \"Are GTFS bundles approaching expiration?\"\n\nVisualization: Bar Gauge\nRationale: This metric is a countdown. Rendering it as a horizontal bar gauge allows operators to stack multiple feeds side-by-side. The bars act as a visual timer that shifts from green to warning red as the days until expiration drop below the critical threshold.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "max": 90, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "yellow", + "value": 7 + }, + { + "color": "green", + "value": 30 + } + ] + }, + "unit": "d" + }, + "overrides": [] + }, "gridPos": { "h": 8, "w": 12, @@ -179,9 +207,27 @@ "y": 10 }, "id": 201, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 75, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "13.0.2", "targets": [ { "expr": "gtfs_bundle_days_until_earliest_expiration{server_id=~\"$server_id\"}", + "legendFormat": "Earliest Expiration (Server {{server_id}})", "refId": "A", "datasource": { "name": "Prometheus" @@ -189,6 +235,7 @@ }, { "expr": "gtfs_bundle_days_until_latest_expiration{server_id=~\"$server_id\"}", + "legendFormat": "Latest Expiration (Server {{server_id}})", "refId": "B", "datasource": { "name": "Prometheus" @@ -196,7 +243,7 @@ } ], "title": "2.1 Feed Expiration", - "type": "timeseries" + "type": "bargauge" }, { "datasource": { From cbc6d5028ce87da3f2b2f973a6e3c388c71baffe Mon Sep 17 00:00:00 2001 From: anant-shipit Date: Mon, 3 Aug 2026 16:57:35 +0530 Subject: [PATCH 2/2] feat(dashboard): display Feed Expiration as weeks+days instead of raw days Changed the unit from 'd' (days) to 'dtdurations' and multiplied the PromQL queries by 86400 to convert days to seconds. Grafana's dtdurations unit auto-formats this into human-readable 'X wk Y d' format. Thresholds updated to seconds equivalents: - Red: < 7 days (604800s) - Yellow: 7-30 days - Green: > 30 days (2592000s) Signed-off-by: anant-shipit --- grafana/dashboards/watchdog_metrics_dashboard.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/grafana/dashboards/watchdog_metrics_dashboard.json b/grafana/dashboards/watchdog_metrics_dashboard.json index 2009b2d8..f0191ebe 100644 --- a/grafana/dashboards/watchdog_metrics_dashboard.json +++ b/grafana/dashboards/watchdog_metrics_dashboard.json @@ -177,7 +177,7 @@ "color": { "mode": "thresholds" }, - "max": 90, + "max": 7776000, "min": 0, "thresholds": { "mode": "absolute", @@ -188,15 +188,15 @@ }, { "color": "yellow", - "value": 7 + "value": 604800 }, { "color": "green", - "value": 30 + "value": 2592000 } ] }, - "unit": "d" + "unit": "dtdurations" }, "overrides": [] }, @@ -226,7 +226,7 @@ "pluginVersion": "13.0.2", "targets": [ { - "expr": "gtfs_bundle_days_until_earliest_expiration{server_id=~\"$server_id\"}", + "expr": "gtfs_bundle_days_until_earliest_expiration{server_id=~\"$server_id\"} * 86400", "legendFormat": "Earliest Expiration (Server {{server_id}})", "refId": "A", "datasource": { @@ -234,7 +234,7 @@ } }, { - "expr": "gtfs_bundle_days_until_latest_expiration{server_id=~\"$server_id\"}", + "expr": "gtfs_bundle_days_until_latest_expiration{server_id=~\"$server_id\"} * 86400", "legendFormat": "Latest Expiration (Server {{server_id}})", "refId": "B", "datasource": {