postgres_exporter
postgres_exporter copied to clipboard
View pg_stat_statements broken in pg13
several fields have been renamed in pg 13 (total_time -> total_exec_time). Then the below query is changed to make the queries.yaml working
query: "SELECT t2.rolname, t3.datname, queryid, calls, total_exec_time / 1000 as total_time_seconds, min_exec_time / 1000 as min_time_seconds, max_exec_time / 1000 as max_time_seconds, mean_exec_time / 1000 as mean_time_seconds, 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, loc
al_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'"```
Want to open a PR to update it?
not sure, because the query won't work on pg < 13 . A PR means introduce a dedicated yaml file ?
parseUserQueries
should support runonserver
options in *.yml
https://github.com/prometheus-community/postgres_exporter/blob/c51a28f5f086f4f011ad9b4c9dcd4e78d1cb2c12/cmd/postgres_exporter/postgres_exporter.go#L121-L127
https://github.com/prometheus-community/postgres_exporter/blob/c51a28f5f086f4f011ad9b4c9dcd4e78d1cb2c12/cmd/postgres_exporter/postgres_exporter.go#L520-L535
Does anybody know how it can be fixed without kludges via custom queries.yml?
Does anybody know how it can be fixed without kludges via custom queries.yml?
Added fix for version >= 13.0.0
Facing the same issue. This PR-553 is awsome. Can someone review the PR and release it as a new feature?
Yep same here ^^
Running into this as well. PG 14 has been released for a while now, this exporter breaks there to. Someone might want to review PR-553?
Also encounter this. I see some conflict in warning about deprecate custom query.yml `Please note, the following features are deprecated and may be removed in a future release: extend.query-path " And not fixed stat_statements collector , see line 78 in collectors/pg_stat_statements.go in master branch And this bug is open, but in helmchart repo there are fixed queries, but in queries file Before deprecate queries file someone need to fix collector..
We do not control the helm charts. Those are up to whoever maintains those.
Since we now have version information in the collector package, it should be easy enough to make the query dynamic.
build container from current master after PR merge pg ver 13.3
postgres_exporter, version 0.13.1 (branch: master, revision: f9277b04b7f614a03a4ca70194abe2045f17c36a)
ts=2023-07-25T14:44:47.786Z caller=postgres_exporter.go:613 level=info msg="Semantic version changed" server=mypgdb:5432 from=0.0.0 to=13.3.0
ts=2023-07-25T14:44:47.761Z caller=collector.go:190 level=error msg="collector failed" name=stat_statements duration_seconds=0.183012101 err="pq: column \"total_time\" not exists"
Maybe it is because line 110 WITHIN GROUP (ORDER BY total_time)
Ahh, sorry, I missed that change.
Works as expected now
postgres_exporter, version 0.13.1 (branch: master, revision: 716ac23f202f664845d04c0d7b07000feae19c59)
ts=2023-07-26T12:33:49.283Z caller=collector.go:194 level=debug msg="collector succeeded" name=stat_statements duration_seconds=0.491161838
ts=2023-07-26T12:33:49.351Z caller=postgres_exporter.go:613 level=info msg="Semantic version changed" server=mypgdb:5432 from=0.0.0 to=13.3.0
@SuperQ is there an ETA for a new version which fixes this issue?