From 621f80496f459485c1f662bfb635d6c7caf1e3b5 Mon Sep 17 00:00:00 2001 From: Kirill Kukartsev Date: Thu, 18 Nov 2021 10:21:11 +0300 Subject: [PATCH 1/2] feat(*): filter out template variables based on instance and release allows to choose datname and access mode more precisely --- dashboards/postgresql-database.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dashboards/postgresql-database.json b/dashboards/postgresql-database.json index 56b026b..b5ec950 100644 --- a/dashboards/postgresql-database.json +++ b/dashboards/postgresql-database.json @@ -3021,6 +3021,7 @@ }, { "allValue": null, + "description": "Namespace where PostgreSQL exporter deployed", "current": {}, "datasource": "${DS_PROMETHEUS}", "definition": "", @@ -3045,6 +3046,7 @@ "allValue": null, "current": {}, "datasource": "${DS_PROMETHEUS}", + "description": "Name of PostgreSQL Exporter deployment", "definition": "", "hide": 0, "includeAll": false, @@ -3068,6 +3070,7 @@ "current": {}, "datasource": "${DS_PROMETHEUS}", "definition": "", + "description": "PostgreSQL exporter instance", "hide": 0, "includeAll": false, "label": "Instance", @@ -3090,13 +3093,14 @@ "current": {}, "datasource": "${DS_PROMETHEUS}", "definition": "", + "description": "Exported database name", "hide": 0, "includeAll": true, "label": "Database", "multi": true, "name": "datname", "options": [], - "query": "label_values(datname)", + "query": "label_values({instance=\"$instance\",release=\"$release\"},datname)", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -3118,7 +3122,7 @@ "multi": true, "name": "mode", "options": [], - "query": "label_values({mode=~\"accessexclusivelock|accesssharelock|exclusivelock|rowexclusivelock|rowsharelock|sharelock|sharerowexclusivelock|shareupdateexclusivelock\"}, mode)", + "query": "label_values({instance=\"$instance\",release=\"$release\",mode=~\"accessexclusivelock|accesssharelock|exclusivelock|rowexclusivelock|rowsharelock|sharelock|sharerowexclusivelock|shareupdateexclusivelock\"}, mode)", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -3162,6 +3166,6 @@ }, "timezone": "", "title": "PostgreSQL Database", - "uid": "000000039", - "version": 1 + "uid": "000000040", + "version": 2 } From 6fb007a8563ea0d83b757848e9b0ccd07ac90dfa Mon Sep 17 00:00:00 2001 From: Kirill Kukartsev Date: Thu, 18 Nov 2021 10:23:54 +0300 Subject: [PATCH 2/2] fix(*): filter pg_settings_seq_page_cost based on instance variable --- dashboards/postgresql-database.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboards/postgresql-database.json b/dashboards/postgresql-database.json index b5ec950..ca96097 100644 --- a/dashboards/postgresql-database.json +++ b/dashboards/postgresql-database.json @@ -1410,7 +1410,7 @@ "tableColumn": "", "targets": [ { - "expr": "pg_settings_seq_page_cost", + "expr": "pg_settings_seq_page_cost{instance=\"$instance\"}", "format": "time_series", "intervalFactor": 1, "refId": "A"