From 7ae4746d10b8f7510eb6a136e84a35280dc4776b Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Fri, 3 Apr 2026 15:23:27 -0300 Subject: [PATCH] monitoring: scope hecate power queries to hecate-power job --- scripts/dashboards_render_atlas.py | 12 +++++++----- services/monitoring/dashboards/atlas-overview.json | 6 +++--- services/monitoring/dashboards/atlas-power.json | 8 ++++---- services/monitoring/grafana-dashboard-overview.yaml | 6 +++--- services/monitoring/grafana-dashboard-power.yaml | 8 ++++---- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/scripts/dashboards_render_atlas.py b/scripts/dashboards_render_atlas.py index 80612df3..fc38bc3f 100644 --- a/scripts/dashboards_render_atlas.py +++ b/scripts/dashboards_render_atlas.py @@ -431,13 +431,15 @@ TEST_SUCCESS_RATE = ( TEST_FAILURES_24H = ( f'sum by (result) (max_over_time(ariadne_ci_tests_total{{{TEST_REPO_SELECTOR},result=~"failed|error"}}[24h]))' ) -HECATE_UPS_ON_BATTERY = "sum(hecate_ups_on_battery) or on() vector(0)" -HECATE_UPS_LOW_BATTERY = "sum(hecate_ups_low_battery) or on() vector(0)" -HECATE_UPS_RUNTIME_MIN = "min(hecate_ups_runtime_seconds) or on() vector(0)" +HECATE_SELECTOR = 'job="hecate-power"' +HECATE_UPS_ON_BATTERY = f"sum(hecate_ups_on_battery{{{HECATE_SELECTOR}}}) or on() vector(0)" +HECATE_UPS_LOW_BATTERY = f"sum(hecate_ups_low_battery{{{HECATE_SELECTOR}}}) or on() vector(0)" +HECATE_UPS_RUNTIME_MIN = f"min(hecate_ups_runtime_seconds{{{HECATE_SELECTOR}}}) or on() vector(0)" HECATE_UPS_RUNTIME_HEADROOM_PERCENT = ( - "100 * min(hecate_ups_runtime_seconds) / clamp_min(max(hecate_ups_threshold_seconds), 1)" + f"100 * min(hecate_ups_runtime_seconds{{{HECATE_SELECTOR}}}) / " + f"clamp_min(max(hecate_ups_threshold_seconds{{{HECATE_SELECTOR}}}), 1)" ) -HECATE_UPS_TRIGGER_COUNT_1D = "increase(hecate_shutdown_triggers_total[1d]) or on() vector(0)" +HECATE_UPS_TRIGGER_COUNT_1D = f"increase(hecate_shutdown_triggers_total{{{HECATE_SELECTOR}}}[1d]) or on() vector(0)" CLIMATE_SENSOR_COUNT = "count(atlas_climate_temperature_celsius) or on() vector(0)" CLIMATE_TEMP_MAX = "max(atlas_climate_temperature_celsius) or on() vector(0)" CLIMATE_HUMIDITY_MAX = "max(atlas_climate_humidity_percent) or on() vector(0)" diff --git a/services/monitoring/dashboards/atlas-overview.json b/services/monitoring/dashboards/atlas-overview.json index f0bf43f7..c6f98664 100644 --- a/services/monitoring/dashboards/atlas-overview.json +++ b/services/monitoring/dashboards/atlas-overview.json @@ -1086,7 +1086,7 @@ }, "targets": [ { - "expr": "sum(hecate_ups_on_battery) or on() vector(0)", + "expr": "sum(hecate_ups_on_battery{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -1158,7 +1158,7 @@ }, "targets": [ { - "expr": "min(hecate_ups_runtime_seconds) or on() vector(0)", + "expr": "min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) or on() vector(0)", "refId": "A" } ], @@ -1234,7 +1234,7 @@ }, "targets": [ { - "expr": "100 * min(hecate_ups_runtime_seconds) / clamp_min(max(hecate_ups_threshold_seconds), 1)", + "expr": "100 * min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) / clamp_min(max(hecate_ups_threshold_seconds{job=\"hecate-power\"}), 1)", "refId": "A" } ], diff --git a/services/monitoring/dashboards/atlas-power.json b/services/monitoring/dashboards/atlas-power.json index 8e4c75d0..ef47c3f2 100644 --- a/services/monitoring/dashboards/atlas-power.json +++ b/services/monitoring/dashboards/atlas-power.json @@ -20,7 +20,7 @@ }, "targets": [ { - "expr": "sum(hecate_ups_on_battery) or on() vector(0)", + "expr": "sum(hecate_ups_on_battery{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -85,7 +85,7 @@ }, "targets": [ { - "expr": "sum(hecate_ups_low_battery) or on() vector(0)", + "expr": "sum(hecate_ups_low_battery{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -150,7 +150,7 @@ }, "targets": [ { - "expr": "min(hecate_ups_runtime_seconds) or on() vector(0)", + "expr": "min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -220,7 +220,7 @@ }, "targets": [ { - "expr": "100 * min(hecate_ups_runtime_seconds) / clamp_min(max(hecate_ups_threshold_seconds), 1)", + "expr": "100 * min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) / clamp_min(max(hecate_ups_threshold_seconds{job=\"hecate-power\"}), 1)", "refId": "A", "instant": true } diff --git a/services/monitoring/grafana-dashboard-overview.yaml b/services/monitoring/grafana-dashboard-overview.yaml index 471a57a6..d37612f0 100644 --- a/services/monitoring/grafana-dashboard-overview.yaml +++ b/services/monitoring/grafana-dashboard-overview.yaml @@ -1095,7 +1095,7 @@ data: }, "targets": [ { - "expr": "sum(hecate_ups_on_battery) or on() vector(0)", + "expr": "sum(hecate_ups_on_battery{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -1167,7 +1167,7 @@ data: }, "targets": [ { - "expr": "min(hecate_ups_runtime_seconds) or on() vector(0)", + "expr": "min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) or on() vector(0)", "refId": "A" } ], @@ -1243,7 +1243,7 @@ data: }, "targets": [ { - "expr": "100 * min(hecate_ups_runtime_seconds) / clamp_min(max(hecate_ups_threshold_seconds), 1)", + "expr": "100 * min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) / clamp_min(max(hecate_ups_threshold_seconds{job=\"hecate-power\"}), 1)", "refId": "A" } ], diff --git a/services/monitoring/grafana-dashboard-power.yaml b/services/monitoring/grafana-dashboard-power.yaml index 21b611c3..e16c3ef8 100644 --- a/services/monitoring/grafana-dashboard-power.yaml +++ b/services/monitoring/grafana-dashboard-power.yaml @@ -29,7 +29,7 @@ data: }, "targets": [ { - "expr": "sum(hecate_ups_on_battery) or on() vector(0)", + "expr": "sum(hecate_ups_on_battery{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -94,7 +94,7 @@ data: }, "targets": [ { - "expr": "sum(hecate_ups_low_battery) or on() vector(0)", + "expr": "sum(hecate_ups_low_battery{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -159,7 +159,7 @@ data: }, "targets": [ { - "expr": "min(hecate_ups_runtime_seconds) or on() vector(0)", + "expr": "min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) or on() vector(0)", "refId": "A", "instant": true } @@ -229,7 +229,7 @@ data: }, "targets": [ { - "expr": "100 * min(hecate_ups_runtime_seconds) / clamp_min(max(hecate_ups_threshold_seconds), 1)", + "expr": "100 * min(hecate_ups_runtime_seconds{job=\"hecate-power\"}) / clamp_min(max(hecate_ups_threshold_seconds{job=\"hecate-power\"}), 1)", "refId": "A", "instant": true }