Missing pg_stat_statements Metrics
We had installed the helm chart to collect metrics from postgres. We can Collect very nice metrics, but we can´t find Metrics with 'pg_stat_statements'. We had activate the Extenstion and also in Config Files 'shared_preload_libraries', and i can select Data with the Username from Collector with 'SELECT * FROM pg_stat_statements;'. But only metrics from 'settings' is found, for example 'pg_settings_pg_stat_statements'
-
postgres_exporter version: v0.15.0
-
PostgreSQL version:
psql (PostgreSQL) 12.17
what is my mistake ?
I Found the Line https://github.com/prometheus-community/postgres_exporter/blob/master/collector/pg_stat_statements.go#L95 this query can´t run on PSQL Version 12.17 because Column Names are different.
Also this line https://github.com/prometheus-community/postgres_exporter/blob/master/collector/pg_stat_statements_test.go#L35
I´m right there ?
there are two queries for pg_stat_statements, the one you are refering has the condition to run in PG greater that 13:
if instance.version.GE(semver.MustParse("13.0.0")) {
query = pgStatStatementsNewQuery
}
If you read the exporter documentation you need to enable some collectors to be able to see these metrics.