Skip to content

Commit fb18d47

Browse files
authored
[*] improve stat-statements Grafana v11 Postgres dashboards (#846)
Replaced deprecated Angular panels with built-in table panels in grafana/postgres/v11 stat-statements dashboards.
1 parent 9ced8ec commit fb18d47

File tree

4 files changed

+1194
-758
lines changed

4 files changed

+1194
-758
lines changed

docker/compose.grafana.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
grafana:
3-
# to use latest Grafana v11, update the dashboards provisioning folder below
3+
# to use latest Grafana v11 (grafana/grafana:11.5.6), update the dashboards provisioning folder below
44
image: grafana/grafana:10.4.15
55
container_name: grafana
66
user: "0:0"

grafana/postgres/v11/stat-statements-sql-search.json

Lines changed: 42 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
}
1616
]
1717
},
18-
"description": "",
1918
"editable": true,
2019
"fiscalYearStartMonth": 0,
2120
"graphTooltip": 0,
21+
"id": 3,
2222
"links": [],
2323
"panels": [
2424
{
@@ -35,7 +35,8 @@
3535
"custom": {
3636
"align": "auto",
3737
"cellOptions": {
38-
"type": "auto"
38+
"type": "auto",
39+
"wrapText": true
3940
},
4041
"inspect": false
4142
},
@@ -97,24 +98,24 @@
9798
"properties": [
9899
{
99100
"id": "unit",
100-
"value": "short"
101-
},
102-
{
103-
"id": "decimals",
104-
"value": 2
101+
"value": "string"
105102
},
106103
{
107104
"id": "links",
108105
"value": [
109106
{
110107
"targetBlank": true,
111108
"title": "Go to Query Details dash",
112-
"url": "/d/single-query-details?var-dbname=$dbname&var-queryid=$__cell"
109+
"url": "/d/single-query-details?var-dbname=$dbname&var-queryid=${__data.fields.queryid}&${__url_time_range}"
113110
}
114111
]
115112
},
116113
{
117114
"id": "custom.align"
115+
},
116+
{
117+
"id": "custom.width",
118+
"value": 100
118119
}
119120
]
120121
},
@@ -132,6 +133,20 @@
132133
"id": "custom.align"
133134
}
134135
]
136+
},
137+
{
138+
"matcher": {
139+
"id": "byName",
140+
"options": "query"
141+
},
142+
"properties": [
143+
{
144+
"id": "custom.cellOptions",
145+
"value": {
146+
"type": "color-text"
147+
}
148+
}
149+
]
135150
}
136151
]
137152
},
@@ -146,15 +161,22 @@
146161
"cellHeight": "sm",
147162
"footer": {
148163
"countRows": false,
164+
"enablePagination": true,
149165
"fields": "",
150166
"reducer": [
151167
"sum"
152168
],
153169
"show": false
154170
},
155-
"showHeader": true
171+
"showHeader": true,
172+
"sortBy": [
173+
{
174+
"desc": true,
175+
"displayName": "total_time"
176+
}
177+
]
156178
},
157-
"pluginVersion": "10.4.1",
179+
"pluginVersion": "11.5.6",
158180
"targets": [
159181
{
160182
"datasource": {
@@ -188,20 +210,12 @@
188210
}
189211
],
190212
"title": "Matching Queries",
191-
"transformations": [
192-
{
193-
"id": "merge",
194-
"options": {
195-
"reducers": []
196-
}
197-
}
198-
],
199213
"type": "table"
200214
},
201215
{
202-
"datasource": {
203-
"type": "grafana-postgresql-datasource",
204-
"uid": "pgwatch-metrics"
216+
"fieldConfig": {
217+
"defaults": {},
218+
"overrides": []
205219
},
206220
"gridPos": {
207221
"h": 5,
@@ -219,29 +233,21 @@
219233
"content": "<h2>Brought to you by</h2><div style=\"padding: 25px;\"><a href=\"https://www.cybertec-postgresql.com/en/\"><img src=\"https://www.cybertec-postgresql.com/wp-content/uploads/2025/02/cybertec-logo-white-blue.svg\" alt=\"Cybertec – The PostgreSQL Database Company\"></a></div>",
220234
"mode": "html"
221235
},
222-
"pluginVersion": "10.4.1",
223-
"targets": [
224-
{
225-
"datasource": {
226-
"type": "grafana-postgresql-datasource",
227-
"uid": "pgwatch-metrics"
228-
},
229-
"refId": "A"
230-
}
231-
],
236+
"pluginVersion": "11.5.6",
237+
"title": "",
232238
"transparent": true,
233239
"type": "text"
234240
}
235241
],
236-
"schemaVersion": 39,
242+
"preload": false,
243+
"schemaVersion": 40,
237244
"tags": [
238245
"pgwatch"
239246
],
240247
"templating": {
241248
"list": [
242249
{
243250
"current": {
244-
"selected": false,
245251
"text": "test",
246252
"value": "test"
247253
},
@@ -250,27 +256,19 @@
250256
"uid": "pgwatch-metrics"
251257
},
252258
"definition": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics WHERE metric = 'stat_statements' ORDER BY 1;",
253-
"hide": 0,
254259
"includeAll": false,
255-
"multi": false,
256260
"name": "dbname",
257261
"options": [],
258262
"query": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics WHERE metric = 'stat_statements' ORDER BY 1;",
259263
"refresh": 1,
260264
"regex": "",
261-
"skipUrlSync": false,
262-
"sort": 0,
263-
"tagValuesQuery": "",
264-
"tagsQuery": "",
265-
"type": "query",
266-
"useTags": false
265+
"type": "query"
267266
},
268267
{
269268
"current": {
270269
"text": "",
271270
"value": ""
272271
},
273-
"hide": 0,
274272
"label": "SQL search fragment (case insensitive, 3 char min.)",
275273
"name": "sql_fragment",
276274
"options": [
@@ -280,20 +278,17 @@
280278
"value": ""
281279
}
282280
],
283-
"query": "",
284-
"skipUrlSync": false,
281+
"query": "UPDATE pgbench_accounts",
285282
"type": "textbox"
286283
},
287284
{
288285
"auto": false,
289286
"auto_count": 30,
290287
"auto_min": "10s",
291288
"current": {
292-
"selected": false,
293289
"text": "12h",
294290
"value": "12h"
295291
},
296-
"hide": 0,
297292
"label": "Having some executions within last",
298293
"name": "calls_interval",
299294
"options": [
@@ -340,7 +335,6 @@
340335
],
341336
"query": "30m,1h,6h,12h,1d,7d,14d,30d",
342337
"refresh": 2,
343-
"skipUrlSync": false,
344338
"type": "interval"
345339
}
346340
]
@@ -349,21 +343,7 @@
349343
"from": "now-12h",
350344
"to": "now"
351345
},
352-
"timepicker": {
353-
"hidden": false,
354-
"refresh_intervals": [
355-
"5s",
356-
"10s",
357-
"30s",
358-
"1m",
359-
"5m",
360-
"15m",
361-
"30m",
362-
"1h",
363-
"2h",
364-
"1d"
365-
]
366-
},
346+
"timepicker": {},
367347
"timezone": "",
368348
"title": "Stat Statements SQL Search",
369349
"uid": "stat-statements-sql-search",

0 commit comments

Comments
 (0)