postgres_exporter
postgres_exporter copied to clipboard
metricPrefix / PG_EXPORTER_METRIC_PREFIX - Not applied for pg_stat_bgwriter etc
What did you do?
The env var PG_EXPORTER_METRIC_PREFIX is set to postgres
What did you expect to see?
Then a metric like pg_stat_bgwriter_maxwritten_clean_total
should be emitted as postgres_stat_bgwriter_maxwritten_clean_total
What did you see instead? Under which circumstances?
The metric prefix is not overwritten. And the metric still is pg_stat_bgwriter_maxwritten_clean_total
Environment
- System information:
Linux 5.10.0-7-cloud-amd64 x86_64
-
postgres_exporter version:
0.10.1
-
postgres_exporter flags:
PG_EXPORTER_METRIC_PREFIX=postgres
-
PostgreSQL version:
13
Not sure why namespace is altered based on metricPrefix https://github.com/prometheus-community/postgres_exporter/blob/d0a3aa991ad0425e461d57c083db2190d4a736b7/cmd/postgres_exporter/postgres_exporter.go#L302
Doing this messes up the builtinMetricMaps. Like pg_stat_database
becomes postgres_stat_database
and leads to
queryNamespaceMappings error
pq: relation \"postgres_stat_database\" does not exist"