From 200ddd887df57282d4a7fa98bf62ee67eaa6ec92 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Fri, 12 Jul 2024 19:52:04 +0200 Subject: [PATCH 1/2] Update token docs to include Actions: read (#319) * update token docs to include Actions: read * be more explicit --- docs/reference/token-scopes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/reference/token-scopes.md b/docs/reference/token-scopes.md index e77072680..ed6973548 100644 --- a/docs/reference/token-scopes.md +++ b/docs/reference/token-scopes.md @@ -16,6 +16,7 @@ Organisation: Repository: +- Actions: read (required if COS integration is enabled and private repositories exist) - Administration: read - Contents: read - Pull requests: read @@ -25,6 +26,7 @@ Repository: The following are the permissions scopes required for the GitHub runners when registering as an repository runner. +- Actions: read (required if COS integration is enabled and the repository is private) - Administration: read & write - Contents: read - Metadata: read From 1091155b5f7844548922857e251710346199ccfc Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Fri, 12 Jul 2024 22:24:39 +0200 Subject: [PATCH 2/2] Grafana Dashboard: Combine 3 queries into one (#317) * combine 3 queries into one * use gh hosted runners --- src/grafana_dashboards/metrics.json | 64 +++++++++++++++-------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/grafana_dashboards/metrics.json b/src/grafana_dashboards/metrics.json index d62b66213..6d1dd36cc 100644 --- a/src/grafana_dashboards/metrics.json +++ b/src/grafana_dashboards/metrics.json @@ -24,7 +24,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 266, + "id": 293, "links": [], "liveNow": false, "panels": [ @@ -113,36 +113,12 @@ "uid": "${lokids}" }, "editorMode": "code", - "expr": "sum by(filename) (count_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\", timestamp=\"timestamp\" | label_format timestamp=\"{{__timestamp__ | unixEpoch | mulf 1000}}\" | event = \"runner_start\" | flavor=~\"$flavor\" | timestamp >= ${__from} [$__range]))", + "expr": "sum by(filename, event) (count_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\", timestamp=\"timestamp\", flavor=\"flavor\" | label_format timestamp=\"{{__timestamp__ | unixEpoch | mulf 1000}}\" | event =~ \"runner_start|runner_stop|runner_installed\" | flavor=~\"$flavor\" | timestamp >= ${__from} [$__range]))", "key": "Q-f7c42eab-69be-43b5-a807-35c071f708a0-0", - "legendFormat": "Started", + "legendFormat": "{{event}}", "queryType": "range", "refId": "A" }, - { - "datasource": { - "type": "loki", - "uid": "${lokids}" - }, - "editorMode": "builder", - "expr": "sum by(filename) (count_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\", timestamp=\"timestamp\", flavor=\"flavor\" | label_format timestamp=\"{{__timestamp__ | unixEpoch | mulf 1000}}\" | event = \"runner_installed\" | flavor=~\"$flavor\" | timestamp >= ${__from} [$__range]))", - "hide": false, - "legendFormat": "Initialized", - "queryType": "range", - "refId": "B" - }, - { - "datasource": { - "type": "loki", - "uid": "${lokids}" - }, - "editorMode": "builder", - "expr": "sum by(filename) (count_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\", timestamp=\"timestamp\", flavor=\"flavor\" | label_format timestamp=\"{{__timestamp__ | unixEpoch | mulf 1000}}\" | event = \"runner_stop\" | flavor=~\"$flavor\" | timestamp >= ${__from} [$__range]))", - "hide": false, - "legendFormat": "Stopped", - "queryType": "range", - "refId": "C" - }, { "datasource": { "type": "loki", @@ -157,7 +133,29 @@ } ], "title": "Lifecycle Status", - "transformations": [], + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "runner_installed", + "renamePattern": "Initialized" + } + }, + { + "id": "renameByRegex", + "options": { + "regex": "runner_start", + "renamePattern": "Started" + } + }, + { + "id": "renameByRegex", + "options": { + "regex": "runner_stop", + "renamePattern": "Stopped" + } + } + ], "type": "timeseries" }, { @@ -186,6 +184,9 @@ "lineWidth": 1, "scaleDistribution": { "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" } }, "decimals": 0, @@ -217,6 +218,7 @@ "options": { "barRadius": 0, "barWidth": 0.97, + "fullHighlight": false, "groupWidth": 0.7, "legend": { "calcs": [], @@ -1575,8 +1577,8 @@ "type": "row" } ], - "refresh": false, - "schemaVersion": 37, + "refresh": "", + "schemaVersion": 38, "style": "dark", "tags": [], "templating": { @@ -1826,6 +1828,6 @@ "timepicker": {}, "timezone": "", "title": "GitHub Self-Hosted Runner Metrics", - "version": 12, + "version": 13, "weekStart": "" }