From 7bb2b90a138d965c502c377e6253d0a336e1d81b Mon Sep 17 00:00:00 2001 From: jenkins Date: Sat, 16 May 2026 12:31:19 -0300 Subject: [PATCH] monitoring: fix gate health status query --- scripts/dashboards_render_atlas.py | 17 +++++++++++++---- .../monitoring/dashboards/atlas-testing.json | 2 +- .../monitoring/grafana-dashboard-testing.yaml | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/dashboards_render_atlas.py b/scripts/dashboards_render_atlas.py index bd31785b..a6b54b78 100644 --- a/scripts/dashboards_render_atlas.py +++ b/scripts/dashboards_render_atlas.py @@ -3601,11 +3601,20 @@ def build_jobs_dashboard(): f'or on(suite) ((0 * ({runs_by_suite_24h})) - 1))' ) non_failure = PLATFORM_TEST_NON_FAILURE_STATUS + current_gate_ok_vector = ( + f'(({{{checks_selector},result=~"{non_failure}"}} > bool 0) ' + f'or ({{{checks_selector},status=~"{non_failure}"}} > bool 0))' + ) + current_gate_seen_vector = f'({{{checks_selector}}} > bool 0)' + current_gate_ok_checks = ( + f"sum by (suite) (max by (suite, check) ({current_gate_ok_vector}))" + ) + current_gate_seen_checks = ( + f"sum by (suite) (max by (suite, check) ({current_gate_seen_vector}))" + ) current_gate_health_by_suite = ( - f'(100 * sum by (suite) (max by (suite, check) ((({{{checks_selector},result=~"{non_failure}"}} > bool 0) ' - f'or ({{{checks_selector},status=~"{non_failure}"}} > bool 0))) ' - f'/ clamp_min(sum by (suite) (max by (suite, check) (({{{checks_selector}}} > bool 0))), 1)) ' - f'or on(suite) ({selected_suite_zero}))' + f"((100 * ({current_gate_ok_checks}) / clamp_min(({current_gate_seen_checks}), 1)) " + f"or on(suite) ({selected_suite_zero}))" ) success_history_runs = f'sum by (suite) (increase(platform_quality_gate_runs_total{{{runs_selector}}}[7d]))' success_history_by_suite = ( diff --git a/services/monitoring/dashboards/atlas-testing.json b/services/monitoring/dashboards/atlas-testing.json index 81cfb808..e4d79500 100644 --- a/services/monitoring/dashboards/atlas-testing.json +++ b/services/monitoring/dashboards/atlas-testing.json @@ -449,7 +449,7 @@ }, "targets": [ { - "expr": "sort((100 * sum by (suite) (max by (suite, check) ((({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",result=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0) or ({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",status=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0))) / clamp_min(sum by (suite) (max by (suite, check) (({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\"} > bool 0))), 1)) or on(suite) ((0 * (count by (suite) (platform_quality_gate_build_info{suite=~\"${suite:regex}\",branch!=\"\",branch=~\"${branch:regex}\",exported_job=\"platform-quality-ci\"}) >= bool 0)))))", + "expr": "sort(((100 * (sum by (suite) (max by (suite, check) ((({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",result=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0) or ({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",status=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0))))) / clamp_min((sum by (suite) (max by (suite, check) (({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\"} > bool 0)))), 1)) or on(suite) ((0 * (count by (suite) (platform_quality_gate_build_info{suite=~\"${suite:regex}\",branch!=\"\",branch=~\"${branch:regex}\",exported_job=\"platform-quality-ci\"}) >= bool 0)))))", "refId": "A", "legendFormat": "{{suite}}", "instant": true diff --git a/services/monitoring/grafana-dashboard-testing.yaml b/services/monitoring/grafana-dashboard-testing.yaml index 7d6650cc..e01a86d1 100644 --- a/services/monitoring/grafana-dashboard-testing.yaml +++ b/services/monitoring/grafana-dashboard-testing.yaml @@ -458,7 +458,7 @@ data: }, "targets": [ { - "expr": "sort((100 * sum by (suite) (max by (suite, check) ((({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",result=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0) or ({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",status=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0))) / clamp_min(sum by (suite) (max by (suite, check) (({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\"} > bool 0))), 1)) or on(suite) ((0 * (count by (suite) (platform_quality_gate_build_info{suite=~\"${suite:regex}\",branch!=\"\",branch=~\"${branch:regex}\",exported_job=\"platform-quality-ci\"}) >= bool 0)))))", + "expr": "sort(((100 * (sum by (suite) (max by (suite, check) ((({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",result=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0) or ({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\",status=~\"ok|passed|success|not_applicable|skipped|na|n/a\"} > bool 0))))) / clamp_min((sum by (suite) (max by (suite, check) (({__name__=~\".*_quality_gate_checks_total\",suite=~\"${suite:regex}\",exported_job=\"platform-quality-ci\"} > bool 0)))), 1)) or on(suite) ((0 * (count by (suite) (platform_quality_gate_build_info{suite=~\"${suite:regex}\",branch!=\"\",branch=~\"${branch:regex}\",exported_job=\"platform-quality-ci\"}) >= bool 0)))))", "refId": "A", "legendFormat": "{{suite}}", "instant": true