postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

Default metrics does not exclude databases

Open CEikermann opened this issue 2 years ago • 3 comments

What did you do?

  • Using "--auto-discover-databases"
  • Using "--exclude-databases" to exclude certain default databases like "postgres", "template0", ....

What did you expect to see?

  • All metrics should only generated for the databases which are not excluded

What did you see instead? Under which circumstances?

  • At least the following metrics "pg_locks_count" and "pg_stat_activity_count" are also generated for excluded databases

Environment

  • postgres_exporter version:

    0.11.1

  • postgres_exporter flags:

--disable-settings-metrics
--auto-discover-databases
--exclude-databases postgres,template0
  • PostgreSQL version:

    14.4

Is this behavior known and is this behavior intended?

CEikermann avatar Dec 22 '22 15:12 CEikermann

Me too. Run as PG_EXPORTER_AUTO_DISCOVER_DATABASES=true -e PG_EXPORTER_INCLUDE_DATABASES=<my base> quay.io/prometheuscommunity/postgres-exporter used version postgres_exporter_build_info{branch="HEAD",goversion="go1.18.5",revision="b5fd2465646a09bb1c8dbd5c9c00b852da93927a",version="0.11.1"} 1

All data about all databases are here (include postgres. template0, template1) pg_stat_activity_count{datname="postgres",server="<myserver>:5432",state="idle"} 4 pg_stat_activity_count{datname="template0",server="<myserver>:5432",state="idle"} 0

Also tried -e PG_EXPORTER_AUTO_DISCOVER_DATABASES=true -e PG_EXPORTER_EXCLUDE_DATABASES=template0,template1,postgres -e PG_EXPORTER_WEB_TELEMETRY_PATH=/metric2 quay.io/prometheuscommunity/postgres-exporter

No effect about exclude, but telemetry_path changed. Also no effect from PG_EXPORTER_AUTO_DISCOVER_DATABASES=true, without it (default false?) all databases showed again.

combrs avatar Jan 31 '23 08:01 combrs

I created a similar, but slightly different issue recently, #750

MichaelDBA avatar Feb 02 '23 12:02 MichaelDBA

@CEikermann did you figure it out?

hcastrofactored avatar May 08 '23 15:05 hcastrofactored