Skip to content

Commit 26ce415

Browse files
committed
Merge branch 'improve-lock-contention-dashboard' into 'main'
Improve Lock contention dashboard naming and UX + "Database: All" option See merge request postgres-ai/postgres_ai!86
2 parents 6a7563b + d088109 commit 26ce415

File tree

1 file changed

+45
-44
lines changed

1 file changed

+45
-44
lines changed

config/grafana/dashboards/Dashboard_13_Lock_waits.json

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
},
3333
"id": 10,
3434
"panels": [],
35-
"title": "Lock blocks overview",
35+
"title": "Blocking overview",
3636
"type": "row"
3737
},
3838
{
3939
"datasource": {
4040
"type": "prometheus",
4141
"uid": "P7A0D6631BB10B34F"
4242
},
43-
"description": "Number of active sessions waiting on heavyweight lock acquisition.",
43+
"description": "Number of active lock conflicts (blocker→blocked pairs).",
4444
"fieldConfig": {
4545
"defaults": {
4646
"color": {
@@ -135,21 +135,21 @@
135135
"uid": "P7A0D6631BB10B34F"
136136
},
137137
"editorMode": "code",
138-
"expr": "count(pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\"}) or vector(0)",
139-
"legendFormat": "Lock blocks",
138+
"expr": "count(pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\"}) or vector(0)",
139+
"legendFormat": "Lock conflicts",
140140
"range": true,
141141
"refId": "A"
142142
}
143143
],
144-
"title": "Lock blocks count",
144+
"title": "Lock conflicts",
145145
"type": "timeseries"
146146
},
147147
{
148148
"datasource": {
149149
"type": "prometheus",
150150
"uid": "P7A0D6631BB10B34F"
151151
},
152-
"description": "Lock block duration over time, showing how long processes have been blocked by locks.",
152+
"description": "How long sessions have been waiting for locks.",
153153
"fieldConfig": {
154154
"defaults": {
155155
"color": {
@@ -241,7 +241,7 @@
241241
"uid": "P7A0D6631BB10B34F"
242242
},
243243
"editorMode": "code",
244-
"expr": "avg(pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\"})",
244+
"expr": "avg(pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\"})",
245245
"legendFormat": "Average wait time",
246246
"range": true,
247247
"refId": "A"
@@ -252,21 +252,21 @@
252252
"uid": "P7A0D6631BB10B34F"
253253
},
254254
"editorMode": "code",
255-
"expr": "max(pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\"})",
255+
"expr": "max(pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\"})",
256256
"legendFormat": "Max wait time",
257257
"range": true,
258258
"refId": "B"
259259
}
260260
],
261-
"title": "Lock block duration",
261+
"title": "Wait duration",
262262
"type": "timeseries"
263263
},
264264
{
265265
"datasource": {
266266
"type": "prometheus",
267267
"uid": "P7A0D6631BB10B34F"
268268
},
269-
"description": "Lock blocks by lock type, showing which types of locks are causing the most contention.",
269+
"description": "Distribution of blocking events by lock type.",
270270
"fieldConfig": {
271271
"defaults": {
272272
"color": {
@@ -350,21 +350,21 @@
350350
"uid": "P7A0D6631BB10B34F"
351351
},
352352
"editorMode": "code",
353-
"expr": "count by (blocked_locktype) (pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\"})",
353+
"expr": "count by (blocked_locktype) (pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\"})",
354354
"legendFormat": "{{blocked_locktype}}",
355355
"range": true,
356356
"refId": "A"
357357
}
358358
],
359-
"title": "Lock blocks by lock type",
359+
"title": "By lock type",
360360
"type": "timeseries"
361361
},
362362
{
363363
"datasource": {
364364
"type": "prometheus",
365365
"uid": "P7A0D6631BB10B34F"
366366
},
367-
"description": "Blocker transaction duration over time, showing how long blocking transactions have been running.",
367+
"description": "How long blocking transactions have been running.",
368368
"fieldConfig": {
369369
"defaults": {
370370
"color": {
@@ -456,8 +456,8 @@
456456
"uid": "P7A0D6631BB10B34F"
457457
},
458458
"editorMode": "code",
459-
"expr": "avg(pgwatch_lock_waits_blocker_tx_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\"})",
460-
"legendFormat": "Average blocker tx duration",
459+
"expr": "avg(pgwatch_lock_waits_blocker_tx_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\"})",
460+
"legendFormat": "Avg blocker age",
461461
"range": true,
462462
"refId": "A"
463463
},
@@ -467,21 +467,21 @@
467467
"uid": "P7A0D6631BB10B34F"
468468
},
469469
"editorMode": "code",
470-
"expr": "max(pgwatch_lock_waits_blocker_tx_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\"})",
471-
"legendFormat": "Max blocker tx duration",
470+
"expr": "max(pgwatch_lock_waits_blocker_tx_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\"})",
471+
"legendFormat": "Max blocker age",
472472
"range": true,
473473
"refId": "B"
474474
}
475475
],
476-
"title": "Blocker transaction duration",
476+
"title": "Blocker age",
477477
"type": "timeseries"
478478
},
479479
{
480480
"datasource": {
481481
"type": "prometheus",
482482
"uid": "P7A0D6631BB10B34F"
483483
},
484-
"description": "Lock blocks by table, showing which tables have the most lock contention.",
484+
"description": "Which tables have the most lock contention.",
485485
"fieldConfig": {
486486
"defaults": {
487487
"color": {
@@ -565,13 +565,13 @@
565565
"uid": "P7A0D6631BB10B34F"
566566
},
567567
"editorMode": "code",
568-
"expr": "count by (blocked_table) (pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\", blocked_table!=\"\"})",
568+
"expr": "count by (blocked_table) (pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\", blocked_table!=\"\"})",
569569
"legendFormat": "{{blocked_table}}",
570570
"range": true,
571571
"refId": "A"
572572
}
573573
],
574-
"title": "Lock blocks by table",
574+
"title": "By table",
575575
"type": "timeseries"
576576
},
577577
{
@@ -584,15 +584,15 @@
584584
},
585585
"id": 11,
586586
"panels": [],
587-
"title": "Lock blocks details",
587+
"title": "Blocking tree",
588588
"type": "row"
589589
},
590590
{
591591
"datasource": {
592592
"type": "prometheus",
593593
"uid": "P7A0D6631BB10B34F"
594594
},
595-
"description": "Detailed lock block information showing blocked and blocking processes with their users, applications, lock types, tables, query IDs, and block durations.",
595+
"description": "Current blocking relationships with process details.",
596596
"fieldConfig": {
597597
"defaults": {
598598
"color": {
@@ -953,15 +953,15 @@
953953
},
954954
"editorMode": "code",
955955
"exemplar": false,
956-
"expr": "pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=\"$db_name\"}",
956+
"expr": "pgwatch_lock_waits_blocked_ms{cluster=\"$cluster_name\", node_name=\"$node_name\", datname=~\"$db_name\"}",
957957
"format": "table",
958958
"instant": true,
959959
"legendFormat": "__auto",
960960
"range": false,
961961
"refId": "A"
962962
}
963963
],
964-
"title": "Lock blocks details",
964+
"title": "Blocking tree",
965965
"transformations": [
966966
{
967967
"id": "organize",
@@ -980,22 +980,22 @@
980980
},
981981
"indexByName": {
982982
"Time": 0,
983-
"datname": 1,
984-
"blocked_pid": 2,
985-
"blocked_user": 3,
986-
"blocked_appname": 4,
987-
"blocked_locktype": 5,
988-
"blocked_mode": 6,
989-
"blocked_table": 7,
990-
"blocked_query_id": 8,
991-
"Value": 9,
992-
"blocker_pid": 10,
993-
"blocker_user": 11,
994-
"blocker_appname": 12,
995-
"blocker_locktype": 13,
996-
"blocker_mode": 14,
997-
"blocker_table": 15,
998-
"blocker_query_id": 16
983+
"blocked_pid": 1,
984+
"blocker_pid": 2,
985+
"Value": 3,
986+
"blocked_user": 4,
987+
"blocker_user": 5,
988+
"blocked_appname": 6,
989+
"blocker_appname": 7,
990+
"blocked_locktype": 8,
991+
"blocker_locktype": 9,
992+
"blocked_mode": 10,
993+
"blocker_mode": 11,
994+
"blocked_table": 12,
995+
"blocker_table": 13,
996+
"blocked_query_id": 14,
997+
"blocker_query_id": 15,
998+
"datname": 16
999999
},
10001000
"renameByName": {}
10011001
}
@@ -1075,7 +1075,8 @@
10751075
},
10761076
"definition": "label_values(pgwatch_db_size_size_b{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)",
10771077
"hide": 0,
1078-
"includeAll": false,
1078+
"includeAll": true,
1079+
"allValue": ".*",
10791080
"multi": false,
10801081
"name": "db_name",
10811082
"options": [],
@@ -1106,8 +1107,8 @@
11061107
]
11071108
},
11081109
"timezone": "",
1109-
"title": "13. Lock blocks details",
1110-
"uid": "lock-waits-details",
1110+
"title": "13. Lock contention",
1111+
"uid": "lock-contention",
11111112
"version": 1,
11121113
"weekStart": ""
11131114
}

0 commit comments

Comments
 (0)