prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.72k stars 723 forks source link

`server` label is not added consistently to metrics #1030

Open KulykDmytro opened 4 months ago

KulykDmytro commented 4 months ago

Hi

At 0.15 running for of RDS instance (in kubernetes) we observing following behaviour. on default settings + queries.yaml These collectors provides server label, other not:

expected that labeling will be consistent (all on or all off) or at least configurable per collector

Environment

AWS EKS

Linux 5.10.214-202.855.amzn2.x86_64 x86_64
variables:
  PG_EXPORTER_EXCLUDE_DATABASES: rdsadmin
  PG_EXPORTER_EXTEND_QUERY_PATH: '/var/lib/postgresql/queries.yaml'
KulykDmytro commented 4 months ago

issue is originated from #888 but not relevant to multiserver scrape

SuperQ commented 4 months ago

I think we were working to eliminate the server label now that we have multi-target exporter setup. This is because there's no need for a server label on proxy scrapes.

SuperQ commented 4 months ago

:eyeglasses: @sysadmind

sysadmind commented 4 months ago

I think there's a decision to be made on whether or not the exporter is going to support multiple DSNs long term. If it does support multiple DSNs, we would need some label to distinguish both. The other option is to deprecate all of those previous collectors in favor of the newer collectors/ package collectors and remove support for multiple DSNs outside of the multi-target support. This should totally eliminate the need for the server label unless I'm missing some other complication.

I think there may be some logic for auto discovering databases that needs to be looked into as well. I think the intent is that some collectors or metrics are database specific.

SuperQ commented 4 months ago

There's a small amount of terminology mixup in some of the flags. There's multiple DSNs to connect to multiple servers. As well as there's the "Discover databases" which is actually used to filter metrics tables about the databases on a single server.

IMO we should eliminate the "multiple DSNs/servers", not the database metrics include/exclude filters for a single server.