From 6614cda8b468697a2fd4c8fabbbd2af415c5d4ad Mon Sep 17 00:00:00 2001 From: Sheogorath <sheogorath@shivering-isles.com> Date: Sat, 8 Oct 2022 02:00:26 +0200 Subject: [PATCH] fix(loki): Use hard-cased loki uid to fix dashboards --- .../loki/dashboards/loki-logs-quick.json | 53 ++++++++----------- .../dashboards/troubleshoot-namespace.json | 24 ++------- 2 files changed, 27 insertions(+), 50 deletions(-) diff --git a/infrastructure/loki/dashboards/loki-logs-quick.json b/infrastructure/loki/dashboards/loki-logs-quick.json index 2df276124..7afc4521c 100644 --- a/infrastructure/loki/dashboards/loki-logs-quick.json +++ b/infrastructure/loki/dashboards/loki-logs-quick.json @@ -1,14 +1,5 @@ { - "__inputs": [ - { - "name": "DS_LOKI", - "label": "Loki", - "description": "", - "type": "datasource", - "pluginId": "loki", - "pluginName": "Loki" - } - ], + "__inputs": [], "__elements": {}, "__requires": [ { @@ -88,7 +79,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "description": "Total Count of log lines in the specified time range", "fieldConfig": { @@ -157,7 +148,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(count_over_time(({container=\"$container\", stream=~\"$stream\", pod=~\"$pod\"})[$__interval]))", @@ -172,7 +163,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "description": "Total Count: of $searchable_pattern in the specified time range", "fieldConfig": { @@ -241,7 +232,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(count_over_time(({container=\"$container\", stream=~\"$stream\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval]))", @@ -256,7 +247,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "description": "Live logs is a like 'tail -f' in a real time", "gridPos": { @@ -280,7 +271,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "{container=\"$container\", pod=~\"$pod\", stream=~\"$stream\"} |~ \"(?i)$searchable_pattern\" ", @@ -295,7 +286,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "fieldConfig": { "defaults": { @@ -346,7 +337,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(count_over_time(({container=\"$container\", pod=~\"$pod\"})[$__interval])) by (stream)", @@ -361,7 +352,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "fieldConfig": { "defaults": { @@ -413,7 +404,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(count_over_time(({container=\"$container\", pod=~\"$pod\", stream=~\"$stream\"} |~ \"(?i)$searchable_pattern\")[$__interval])) by (pod)", @@ -427,7 +418,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "fieldConfig": { "defaults": { @@ -493,7 +484,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(count_over_time(({container=\"$container\", stream=~\"$stream\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval])) * 100 / sum(count_over_time(({container=\"$container\", stream=~\"$stream\", pod=~\"$pod\"})[$__interval]))", @@ -512,7 +503,7 @@ "dashes": false, "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "decimals": 0, "fieldConfig": { @@ -568,7 +559,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(count_over_time(({container=\"$container\", pod=~\"$pod\", stream=~\"$stream\"} |~ \"(?i)$searchable_pattern\")[$__interval])) by (pod)", @@ -617,7 +608,7 @@ "dashes": false, "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "fieldConfig": { "defaults": { @@ -667,7 +658,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(rate(({container=\"$container\", stream=~\"$stream\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[30s])) by (pod)", @@ -715,7 +706,7 @@ "dashes": false, "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "fieldConfig": { "defaults": { @@ -781,7 +772,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "editorMode": "code", "expr": "sum(count_over_time(({container=\"$container\", pod=~\"$pod\"})[$__interval])) by (stream)", @@ -837,7 +828,7 @@ "current": {}, "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "definition": "label_values({container=~\".+\"}, container)", "hide": 0, @@ -860,7 +851,7 @@ "current": {}, "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "definition": "label_values({container=\"$container\"}, pod)", "hide": 0, @@ -883,7 +874,7 @@ "current": {}, "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "definition": "label_values({container=\"$container\"}, stream)", "hide": 0, diff --git a/infrastructure/loki/dashboards/troubleshoot-namespace.json b/infrastructure/loki/dashboards/troubleshoot-namespace.json index f2716cc9b..21ee898f8 100644 --- a/infrastructure/loki/dashboards/troubleshoot-namespace.json +++ b/infrastructure/loki/dashboards/troubleshoot-namespace.json @@ -2,19 +2,11 @@ "__inputs": [ { "name": "DS_PROMETHEUS", - "label": "Prometheus", + "label": "DS_PROMETHEUS", "description": "", "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" - }, - { - "name": "DS_LOKI", - "label": "Loki", - "description": "", - "type": "datasource", - "pluginId": "loki", - "pluginName": "Loki" } ], "__elements": {}, @@ -2812,7 +2804,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "description": "Similar to: kubectl logs pod \n- \n-\n\nFor more info use dashboards\n-\n- Default / Logs by App\n\n", "gridPos": { @@ -2836,7 +2828,7 @@ { "datasource": { "type": "loki", - "uid": "${DS_LOKI}" + "uid": "loki-system" }, "expr": "{stream=~\"stderr\", namespace=\"$namespace\", container=\"$container_error\"}", "instant": false, @@ -2853,14 +2845,8 @@ "schemaVersion": 37, "style": "dark", "tags": [ - "troubleshooting", - "trouble", - "pod", - "pods", - "kubectl", - "fast view", - "sre", - "simple" + "loki", + "logging" ], "templating": { "list": [ -- GitLab