Add a metric for tracking the number of granted locks

This commit is contained in:
James Campbell 2025-09-23 01:14:50 -04:00
parent 43cd162313
commit 75c5d76047
Signed by: james
GPG Key ID: 2287C33A40DC906A

View File

@ -230,7 +230,19 @@ metrics:
SELECT COUNT(*) FILTER (WHERE has_sequence_privilege(c.oid, 'SELECT,USAGE')) AS visible_sequences,
COUNT(*) AS total_sequences
FROM pg_class AS c
WHERE relkind = 'S';
WHERE relkind = 'S'
locks:
type: row
query:
0:
SELECT COUNT(*) AS total,
SUM(CASE WHEN granted THEN 1 ELSE 0 END) AS granted
FROM pg_locks
90400: >
SELECT COUNT(*) AS total,
COUNT(*) FILTER (WHERE granted) AS granted
FROM pg_locks
##