Skip to content

Commit 8cf2418

Browse files
[prometheus-postgres-exporter] Remove pg_database query (#2752)
* [postgres-exporter] Remove pg_database query After the merge of prometheus-community/postgres_exporter#613, `postgres-exporter` installed by recent versions of the prometheus-postgres-exporter Helm chart is throwing 500 errors like: ``` HTTP/1.1 500 Internal Server Error Content-Type: text/plain; charset=utf-8 X-Content-Type-Options: nosniff Date: Tue, 29 Nov 2022 11:08:41 GMT Content-Length: 1418 An error has occurred while serving metrics: 4 error(s) occurred: * collected metric "pg_database_size_bytes" { label:<name:"datname" value:"template0" > label:<name:"server" value:"10.188.0.2:5432" > gauge:<value:8.225283e+06 > } was collected before with the same name and label values * collected metric "pg_database_size_bytes" { label:<name:"datname" value:"postgres" > label:<name:"server" value:"10.188.0.2:5432" > gauge:<value:8.373103e+06 > } was collected before with the same name and label values * collected metric "pg_database_size_bytes" { label:<name:"datname" value:"template1" > label:<name:"server" value:"10.188.0.2:5432" > gauge:<value:8.373103e+06 > } was collected before with the same name and label values * collected metric "pg_database_size_bytes" { label:<name:"datname" value:"default" > label:<name:"server" value:"10.188.0.2:5432" > gauge:<value:8.373103e+06 > } was collected before with the same name and label values ``` So we're removing the YAML query to avoid such conflict. Signed-off-by: Ahmad Sherif <[email protected]> * [prometheus-postgres-exporter] Bump version to 3.3.1 Signed-off-by: Ahmad Sherif <[email protected]> * [prometheus-postgres-exporter] Bump version to 4.0.0 Signed-off-by: Ahmad Sherif <[email protected]> * Add upgrading notes to README.md Signed-off-by: Ahmad Sherif <[email protected]> Signed-off-by: Ahmad Sherif <[email protected]> Co-authored-by: MH <[email protected]>
1 parent 2c545b6 commit 8cf2418

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

charts/prometheus-postgres-exporter/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: "0.11.1"
33
description: A Helm chart for prometheus postgres-exporter
44
name: prometheus-postgres-exporter
5-
version: 3.3.0
5+
version: 4.0.0
66
home: https://github.com/prometheus-community/postgres_exporter
77
sources:
88
- https://github.com/prometheus-community/postgres_exporter

charts/prometheus-postgres-exporter/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ _See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command doc
4040

4141
## Upgrading
4242

43+
### To 4.0.0
44+
45+
This release removes the `pg_database` query from `config.queries` as it has been converted to a built-in collector
46+
in postgres_exporter v0.11.0. Any customizations to the removed query are now rendered useless and thus should be removed.
47+
4348
### To 3.0.0
4449

4550
This release introduces changes to accommodate Postgres 13 or newer versions by default.

charts/prometheus-postgres-exporter/values.yaml

-12
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,6 @@ config:
315315
usage: "COUNTER"
316316
description: "Number of buffer hits in this table's TOAST table indexes (if any)"
317317
318-
pg_database:
319-
query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size_bytes FROM pg_database"
320-
master: true
321-
cache_seconds: 30
322-
metrics:
323-
- datname:
324-
usage: "LABEL"
325-
description: "Name of the database"
326-
- size_bytes:
327-
usage: "GAUGE"
328-
description: "Disk space used by the database"
329-
330318
pg_stat_statements:
331319
query: "SELECT t2.rolname, t3.datname, queryid, calls, ( total_plan_time + total_exec_time ) / 1000 as total_time_seconds, ( min_plan_time + min_exec_time ) / 1000 as min_time_seconds, ( max_plan_time + max_exec_time ) / 1000 as max_time_seconds, ( mean_plan_time + mean_exec_time ) / 1000 as mean_time_seconds, ( stddev_plan_time + stddev_exec_time ) / 1000 as stddev_time_seconds, rows, shared_blks_hit, shared_blks_read, shared_blks_dirtied, shared_blks_written, local_blks_hit, local_blks_read, local_blks_dirtied, local_blks_written, temp_blks_read, temp_blks_written, blk_read_time / 1000 as blk_read_time_seconds, blk_write_time / 1000 as blk_write_time_seconds FROM pg_stat_statements t1 JOIN pg_roles t2 ON (t1.userid=t2.oid) JOIN pg_database t3 ON (t1.dbid=t3.oid) WHERE t2.rolname != 'rdsadmin' AND queryid IS NOT NULL"
332320
master: true

0 commit comments

Comments
 (0)