Postgres Size Metric requires CONNECT permissions to all Databases
- Dominant language
- Go
- Stars
- 166
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
## Description
The Postgres size metric seems to run the following query
`"SELECT pg_database.datname, pg_database_size(pg_database.datname) as size_bytes FROM pg_database"` seen (https://github.com/go-gorm/prometheus/blob/54c3070d1effea802b2d9db71a2e7032fa36b78a/postgres.go#L207)
This query fails with the following on AWS RDS
`ERROR: permission denied for database rdsadmin`
This is because it would require CONNECT permissions to all database to get the size with `pg_database_size`
When metrics are collected they should only reference the current database.
Is there any reason not to change this to be something like
`SELECT current_database() as datname, pg_database_size(current_database()) size_bytes;`
?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.