From 7172308dff9db5e9846bc6c5e71d2e95dcd98d50 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Fri, 25 Oct 2024 09:12:47 +0200 Subject: [PATCH] update Available runners panel to include max expected --- docs/reference/cos.md | 2 +- src/grafana_dashboards/metrics.json | 38 ++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/docs/reference/cos.md b/docs/reference/cos.md index 9082ed7bf..e1a0c4d26 100644 --- a/docs/reference/cos.md +++ b/docs/reference/cos.md @@ -12,7 +12,7 @@ The "GitHub Self-Hosted Runner Metrics" metrics dashboard presents the following - General: Displays general metrics about the charm and runners, such as: - Lifecycle counters: Tracks the frequency of Runner initialisation, start, stop, and crash events. - - Available runners: A horizontal bar graph showing the number of runners available during the last reconciliation event. Note: This data is updated after each reconciliation event and is not real-time. + - Available runners: A horizontal bar graph showing the number of runners available (and max expected) during the last reconciliation event. Note: This data is updated after each reconciliation event and is not real-time. - Runners after reconciliation: A time series graph showing the number of runners marked as active/idle and the number of expected runners during the last reconciliation event over time. Note: This data is updated after each reconciliation event and is not real-time. - Duration observations: Each data point aggregates the last hour and shows the 50th, 90th, 95th percentile and maximum durations for: - Runner installation diff --git a/src/grafana_dashboards/metrics.json b/src/grafana_dashboards/metrics.json index dc5aea8e9..8bc61762e 100644 --- a/src/grafana_dashboards/metrics.json +++ b/src/grafana_dashboards/metrics.json @@ -176,7 +176,7 @@ "type": "loki", "uid": "${lokids}" }, - "description": "Shows the number of available runners per application. Note: Available equals idle after reconciliation and is not a real-time metric as it is only updated after each reconciliation interval for each unit.", + "description": "Shows the number of available (and max expected) runners per application. Note: Available equals idle after reconciliation and is not a real-time metric as it is only updated after each reconciliation interval for each unit.\n\nNote that there is no maximum expected number of reactive runners.", "fieldConfig": { "defaults": { "color": { @@ -229,6 +229,26 @@ "value": "Available" } ] + }, + { + "matcher": { + "id": "byName", + "options": "Value #B" + }, + "properties": [ + { + "id": "displayName", + "value": "Max possible" + }, + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "custom.fillOpacity", + "value": 0 + } + ] } ] }, @@ -248,11 +268,11 @@ "calcs": [], "displayMode": "list", "placement": "right", - "showLegend": false + "showLegend": true }, "orientation": "horizontal", "showValue": "always", - "stacking": "none", + "stacking": "normal", "tooltip": { "mode": "single", "sort": "none" @@ -272,6 +292,18 @@ "legendFormat": "", "queryType": "instant", "refId": "A" + }, + { + "datasource": { + "type": "loki", + "uid": "${lokids}" + }, + "editorMode": "code", + "expr": "sum by(flavor)(last_over_time({filename=\"/var/log/github-runner-metrics.log\", juju_application=~\"$juju_application\", juju_model=~\"$juju_model\", juju_model_uuid=~\"$juju_model_uuid\", juju_unit=~\"$juju_unit\"} | json event=\"event\",expected_runners=\"expected_runners\",flavor=\"flavor\" | __error__=\"\" | event=\"reconciliation\" | unwrap expected_runners[$__range]))", + "hide": false, + "legendFormat": "", + "queryType": "instant", + "refId": "B" } ], "title": "Available Runners",