Skip to content

Commit 528cdb6

Browse files
author
Muhammad Shahzeb
committed
Fix PostgresAcquiredTooManyLocks
1 parent 517da2c commit 528cdb6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

postgres_mixin/alerts/postgres.libsonnet

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,14 @@
157157
summary: 'PostgreSQL has high number of acquired locks.',
158158
},
159159
expr: |||
160-
max by(datname, %(agg)s) ((pg_locks_count{%(dbNameFilter)s}) /
161-
on(%(agg)s) group_left(server) (pg_settings_max_locks_per_transaction{} * pg_settings_max_connections{})) > 0.20
162-
||| % $._config { agg: std.join(', ', $._config.groupLabels + $._config.instanceLabels) },
160+
max by(datname, %(agg)s) (
161+
(pg_locks_count{%(dbNameFilter)s})
162+
/
163+
on(%(aggWithoutServer)s) group_left(server) (
164+
pg_settings_max_locks_per_transaction{} * pg_settings_max_connections{}
165+
)
166+
) > 0.20
167+
||| % $._config { agg: std.join(',', $._config.groupLabels + $._config.instanceLabels), aggWithoutServer: std.join(',', std.filter(function(x) x != "server", $._config.groupLabels + $._config.instanceLabels)) },
163168
'for': '5m',
164169
labels: {
165170
severity: 'warning',

0 commit comments

Comments
 (0)