From 4d62d48104a06d881fd51381344fddbc2049d469 Mon Sep 17 00:00:00 2001 From: David Gomes Date: Fri, 22 Sep 2023 20:06:13 +0100 Subject: [PATCH] feat: update dashboards --- .../grafana-dashboards/host-metrics.json | 12 +- server/docker/grafana-dashboards/logs.json | 326 +++++++++++++++--- server/docker/grafana-dashboards/metrics.json | 123 +++---- .../grafana-dashboards/runner-logs.json | 121 +++++++ 4 files changed, 461 insertions(+), 121 deletions(-) create mode 100644 server/docker/grafana-dashboards/runner-logs.json diff --git a/server/docker/grafana-dashboards/host-metrics.json b/server/docker/grafana-dashboards/host-metrics.json index 3852acd..2b0e6e0 100644 --- a/server/docker/grafana-dashboards/host-metrics.json +++ b/server/docker/grafana-dashboards/host-metrics.json @@ -1968,9 +1968,13 @@ "color": "green", "value": null }, + { + "color": "#EAB839", + "value": 65 + }, { "color": "red", - "value": 85 + "value": 75 } ] }, @@ -2015,13 +2019,13 @@ "format": "time_series", "interval": "", "intervalFactor": 1, - "legendFormat": "Temperature Cº", + "legendFormat": "Temperature", "range": true, "refId": "A", "step": 240 } ], - "title": "Hardware temperature monitor", + "title": "Temperature", "type": "timeseries" } ], @@ -2157,6 +2161,6 @@ "timezone": "browser", "title": "Host Metrics", "uid": "rYdddlPWk", - "version": 14, + "version": 17, "weekStart": "" } \ No newline at end of file diff --git a/server/docker/grafana-dashboards/logs.json b/server/docker/grafana-dashboards/logs.json index c78055a..b215b08 100644 --- a/server/docker/grafana-dashboards/logs.json +++ b/server/docker/grafana-dashboards/logs.json @@ -28,6 +28,12 @@ "id": "loki", "name": "Loki", "version": "1.0.0" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" } ], "annotations": { @@ -76,22 +82,153 @@ "uid": "${DS_LOKI}" }, "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "text", + "mode": "fixed" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "color-text" + }, + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "custom.width", + "value": 170 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Module Path" + }, + "properties": [ + { + "id": "custom.width", + "value": 397 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Line" + }, + "properties": [ + { + "id": "custom.width", + "value": 54 + }, + { + "id": "custom.align", + "value": "center" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Level" + }, + "properties": [ + { + "id": "custom.width", + "value": 77 + }, + { + "id": "custom.align", + "value": "center" + }, + { + "id": "mappings", + "value": [ + { + "options": { + "debug": { + "color": "#808080", + "index": 1, + "text": "DEBUG" + }, + "error": { + "color": "semi-dark-red", + "index": 2, + "text": "ERROR" + }, + "info": { + "color": "blue", + "index": 0, + "text": "INFO" + }, + "warn": { + "color": "yellow", + "index": 3, + "text": "WARN" + } + }, + "type": "value" + } + ] + }, + { + "id": "custom.filterable", + "value": true + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Message" + }, + "properties": [] + } + ] + }, "gridPos": { - "h": 10, - "w": 13, + "h": 11, + "w": 24, "x": 0, "y": 1 }, "id": 2, "options": { - "dedupStrategy": "none", - "enableLogDetails": false, - "prettifyLogMessage": false, - "showCommonLabels": false, - "showLabels": false, - "showTime": false, - "sortOrder": "Ascending", - "wrapLogMessage": true + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] }, "pluginVersion": "9.4.3", "targets": [ @@ -101,37 +238,112 @@ "uid": "${DS_LOKI}" }, "editorMode": "builder", - "expr": "{job=\"rusty-server\"}", + "expr": "{host=\"rusty_controller\"} | json", "queryType": "range", "refId": "A" } ], "title": "Server", - "transformations": [], - "type": "logs" + "transformations": [ + { + "id": "extractFields", + "options": { + "format": "json", + "jsonPaths": [ + { + "alias": "Module Path", + "path": "_module_path" + }, + { + "alias": "File", + "path": "_file" + }, + { + "alias": "Line", + "path": "_line" + }, + { + "alias": "Message", + "path": "message" + }, + { + "alias": "Level", + "path": "level" + } + ], + "keepTime": true, + "replace": true, + "source": "labels" + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "File": true, + "id": true, + "labels": true, + "line": true, + "tsNs": true + }, + "indexByName": { + "File": 2, + "Level": 4, + "Line": 3, + "Message": 5, + "Module Path": 1, + "Time": 0 + }, + "renameByName": { + "File": "", + "Line": "", + "Line Number": "Line", + "Message": "" + } + } + } + ], + "type": "table" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 8, + "panels": [], + "title": "Plugins", + "type": "row" }, { "datasource": { "type": "loki", "uid": "${DS_LOKI}" }, + "description": "", "gridPos": { - "h": 10, - "w": 6, - "x": 13, - "y": 1 + "h": 8, + "w": 8, + "x": 0, + "y": 13 }, - "id": 4, + "id": 10, + "maxPerRow": 3, "options": { "dedupStrategy": "none", "enableLogDetails": false, "prettifyLogMessage": false, "showCommonLabels": false, "showLabels": false, - "showTime": true, + "showTime": false, "sortOrder": "Ascending", "wrapLogMessage": true }, + "repeat": "plugin", + "repeatDirection": "h", "targets": [ { "datasource": { @@ -139,27 +351,14 @@ "uid": "${DS_LOKI}" }, "editorMode": "code", - "expr": "{filename=\"/var/log/rusty-controller/run-all.log\"}", + "expr": "{filename=\"/var/log/rusty-controller/plugins/$plugin.log\"} |= ``", "queryType": "range", "refId": "A" } ], - "title": "Plugins runner", + "title": "$plugin", "type": "logs" }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 11 - }, - "id": 8, - "panels": [], - "title": "Plugins", - "type": "row" - }, { "datasource": { "type": "loki", @@ -168,11 +367,11 @@ "description": "", "gridPos": { "h": 8, - "w": 8, + "w": 12, "x": 0, - "y": 12 + "y": 21 }, - "id": 10, + "id": 43, "maxPerRow": 3, "options": { "dedupStrategy": "none", @@ -184,7 +383,7 @@ "sortOrder": "Ascending", "wrapLogMessage": true }, - "repeat": "plugin", + "repeat": "adhocplugin", "repeatDirection": "h", "targets": [ { @@ -193,12 +392,12 @@ "uid": "${DS_LOKI}" }, "editorMode": "code", - "expr": "{filename=\"/var/log/rusty-controller/plugins/$plugin.log\"} |= ``", + "expr": "{filename=\"/var/log/rusty-controller/plugins/$adhocplugin.log\"} |= ``", "queryType": "range", "refId": "A" } ], - "title": "$plugin", + "title": "$adhocplugin", "type": "logs" }, { @@ -207,7 +406,7 @@ "h": 1, "w": 24, "x": 0, - "y": 28 + "y": 29 }, "id": 16, "panels": [], @@ -221,9 +420,9 @@ }, "gridPos": { "h": 8, - "w": 8, + "w": 12, "x": 0, - "y": 29 + "y": 30 }, "id": 26, "maxPerRow": 3, @@ -237,7 +436,7 @@ "sortOrder": "Ascending", "wrapLogMessage": true }, - "repeat": "plugin", + "repeat": "adhocplugin", "repeatDirection": "h", "targets": [ { @@ -246,16 +445,16 @@ "uid": "${DS_LOKI}" }, "editorMode": "code", - "expr": "{filename=\"/var/log/rusty-controller/plugins/cron/$plugin.log\"} |= ``", + "expr": "{filename=\"/var/log/rusty-controller/plugins/cron/$adhocplugin.log\"} |= ``", "queryType": "range", "refId": "A" } ], - "title": "$plugin", + "title": "$adhocplugin", "type": "logs" } ], - "refresh": "10s", + "refresh": "5s", "revision": 1, "schemaVersion": 38, "style": "dark", @@ -297,6 +496,33 @@ "selected": false, "text": "ruscue", "value": "ruscue" + } + ], + "query": "brewertender,stretchy,ruscue", + "queryValue": "", + "skipUrlSync": false, + "type": "custom" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "hide": 0, + "includeAll": true, + "label": "Ad-Hoc Plugin", + "multi": true, + "name": "adhocplugin", + "options": [ + { + "selected": true, + "text": "All", + "value": "$__all" }, { "selected": false, @@ -309,7 +535,7 @@ "value": "rustea" } ], - "query": "brewertender,stretchy,ruscue,weathery,rustea", + "query": "weathery,rustea", "queryValue": "", "skipUrlSync": false, "type": "custom" @@ -317,13 +543,13 @@ ] }, "time": { - "from": "now-24h", + "from": "now-6h", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Logs", "uid": "UKUM1tWRz", - "version": 29, + "version": 42, "weekStart": "" } \ No newline at end of file diff --git a/server/docker/grafana-dashboards/metrics.json b/server/docker/grafana-dashboards/metrics.json index a04dd26..cbb3aee 100644 --- a/server/docker/grafana-dashboards/metrics.json +++ b/server/docker/grafana-dashboards/metrics.json @@ -7,14 +7,6 @@ "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" - }, - { - "name": "DS_LOKI", - "label": "Loki", - "description": "", - "type": "datasource", - "pluginId": "loki", - "pluginName": "Loki" } ], "__elements": {}, @@ -25,12 +17,6 @@ "name": "Grafana", "version": "9.4.3" }, - { - "type": "datasource", - "id": "loki", - "name": "Loki", - "version": "1.0.0" - }, { "type": "datasource", "id": "prometheus", @@ -142,7 +128,7 @@ "orientation": "auto", "reduceOptions": { "calcs": [ - "lastNotNull" + "last" ], "fields": "", "values": false @@ -163,6 +149,7 @@ } ], "title": "Connected Devices", + "transformations": [], "type": "stat" }, { @@ -180,8 +167,8 @@ }, { "datasource": { - "type": "loki", - "uid": "${DS_LOKI}" + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "description": "Time it waited to start running", "fieldConfig": { @@ -241,7 +228,7 @@ } ] }, - "unit": "µs" + "unit": "s" }, "overrides": [] }, @@ -276,51 +263,26 @@ "targets": [ { "datasource": { - "type": "loki", - "uid": "${DS_LOKI}" + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "{host=\"rusty_controller\"} | json | _target = `rusty_controller::metrics` | task = `$task`", - "queryType": "range", + "expr": "rate(scheduled_duration_sum{task=\"$task\"}[$__rate_interval])", + "hide": false, + "legendFormat": "__auto", + "range": true, "refId": "A" } ], "title": "[$task] Scheduled duration", - "transformations": [ - { - "id": "extractFields", - "options": { - "format": "json", - "jsonPaths": [ - { - "path": "scheduled_duration_micros" - } - ], - "keepTime": true, - "replace": true, - "source": "labels" - } - }, - { - "id": "convertFieldType", - "options": { - "conversions": [ - { - "destinationType": "number", - "targetField": "scheduled_duration_micros" - } - ], - "fields": {} - } - } - ], + "transformations": [], "transparent": true, "type": "timeseries" }, { "datasource": { - "type": "loki", - "uid": "${DS_LOKI}" + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "description": "Time it spent running", "fieldConfig": { @@ -379,9 +341,34 @@ } ] }, - "unit": "µs" + "unit": "s" }, - "overrides": [] + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "poll duration" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] }, "gridPos": { "h": 8, @@ -414,12 +401,13 @@ "targets": [ { "datasource": { - "type": "loki", - "uid": "${DS_LOKI}" + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "{host=\"rusty_controller\"} | json | _target = `rusty_controller::metrics` | task = `$task`", - "queryType": "range", + "expr": "rate(poll_duration_sum{task=\"$task\"}[$__rate_interval])", + "legendFormat": "__auto", + "range": true, "refId": "A" } ], @@ -457,8 +445,8 @@ }, { "datasource": { - "type": "loki", - "uid": "${DS_LOKI}" + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "description": "Time it slept (waiting for the interval tick)", "fieldConfig": { @@ -517,7 +505,7 @@ } ] }, - "unit": "ms" + "unit": "s" }, "overrides": [] }, @@ -552,12 +540,13 @@ "targets": [ { "datasource": { - "type": "loki", - "uid": "${DS_LOKI}" + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "{host=\"rusty_controller\"} | json | _target = `rusty_controller::metrics` | task = `$task`", - "queryType": "range", + "expr": "rate(idle_duration_sum{task=\"$task\"}[$__rate_interval])", + "legendFormat": "__auto", + "range": true, "refId": "A" } ], @@ -611,7 +600,7 @@ "type": "timeseries" } ], - "refresh": "5s", + "refresh": "30s", "revision": 1, "schemaVersion": 38, "style": "dark", @@ -674,6 +663,6 @@ "timezone": "", "title": "Metrics", "uid": "TrD1CkZgk", - "version": 24, + "version": 38, "weekStart": "" } \ No newline at end of file diff --git a/server/docker/grafana-dashboards/runner-logs.json b/server/docker/grafana-dashboards/runner-logs.json new file mode 100644 index 0000000..2513ea2 --- /dev/null +++ b/server/docker/grafana-dashboards/runner-logs.json @@ -0,0 +1,121 @@ +{ + "__inputs": [ + { + "name": "DS_LOKI", + "label": "Loki", + "description": "", + "type": "datasource", + "pluginId": "loki", + "pluginName": "Loki" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "9.4.3" + }, + { + "type": "panel", + "id": "logs", + "name": "Logs", + "version": "" + }, + { + "type": "datasource", + "id": "loki", + "name": "Loki", + "version": "1.0.0" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "${DS_LOKI}" + }, + "description": "", + "gridPos": { + "h": 28, + "w": 15, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "dedupStrategy": "none", + "enableLogDetails": false, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Ascending", + "wrapLogMessage": false + }, + "pluginVersion": "9.4.3", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${DS_LOKI}" + }, + "editorMode": "builder", + "expr": "{filename=\"/var/log/rusty-controller/launch-all.log\"}", + "legendFormat": "adasd", + "queryType": "range", + "refId": "A" + } + ], + "title": "Launch all", + "type": "logs" + } + ], + "refresh": "", + "revision": 1, + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Runners Logs", + "uid": "8Cp8iVZRz", + "version": 3, + "weekStart": "" +} \ No newline at end of file