Skip to content

Commit 7f08c9a

Browse files
committed
add pg_database_size metric
1 parent 22534f7 commit 7f08c9a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

queries.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,17 @@ pg_stat_user_tables:
9898
- autoanalyze_count:
9999
usage: "COUNTER"
100100
description: "Number of times this table has been analyzed by the autovacuum daemon"
101+
102+
pg_database:
103+
query: "SELECT d.datname AS name, pg_catalog.pg_get_userbyid(d.datdba) AS owner, CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE 0 END AS size FROM pg_catalog.pg_database d ORDER BY CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE NULL END DESC"
104+
metrics:
105+
- name:
106+
usage: "LABEL"
107+
description: "Name of the schema that this table is in"
108+
- owner:
109+
usage: "LABEL"
110+
description: "Owner of this database"
111+
- size:
112+
usage: "GAUGE"
113+
description: "Owner of this database"
114+

0 commit comments

Comments
 (0)