Skip to content

Multi-DSN causes duplicate metric errors for built-in stat queries #296

@keithf4

Description

@keithf4

Been trying to get Multi-DSN working with 0.5.1, but not having much luck. Was getting these errors when running it as a systemd service in CentOS, but also still getting exact same thing when running directly either with socket

DATA_SOURCE_NAME="postgresql:///keith?host=/tmp/,postgresql:///postgres?host=/tmp/" ./postgres_exporter

or tcp

DATA_SOURCE_NAME="postgresql:///keith?host=localhost&sslmode=disable,postgresql:///postgres?host=localhost&sslmode=disable" ./postgres_exporter

The built in metrics are causing tons of dupe metric errors because there's no label to distinguish them between multiple databases

* collected metric pg_stat_activity_count label:<name:"datname" value:"keith" > label:<name:"server" value:"localhost:5432" > label:<name:"state" value:"disabled" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric pg_stat_activity_max_tx_duration label:<name:"datname" value:"keith" > label:<name:"server" value:"localhost:5432" > label:<name:"state" value:"disabled" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric pg_stat_bgwriter_checkpoints_timed label:<name:"server" value:"localhost:5432" > counter:<value:13676 >  was collected before with the same name and label values
* collected metric pg_stat_bgwriter_checkpoints_req label:<name:"server" value:"localhost:5432" > counter:<value:3 >  was collected before with the same name and label values
* collected metric pg_stat_bgwriter_checkpoint_write_time label:<name:"server" value:"localhost:5432" > counter:<value:5.494712e+06 >  was collected before with the same name and label values

Disabling built-in metrics does not help with this either since it does the same thing with the pg_settings stuff that's always output

DATA_SOURCE_NAME="postgresql:///keith?host=localhost&sslmode=disable,postgresql:///postgres?host=localhost&sslmode=disable" ./postgres_exporter --disable-default-metrics
* collected metric pg_settings_wal_block_size label:<name:"server" value:"localhost:5432" > gauge:<value:8192 >  was collected before with the same name and label values
* collected metric pg_settings_wal_buffers_bytes label:<name:"server" value:"localhost:5432" > gauge:<value:4.194304e+06 >  was collected before with the same name and label values
* collected metric pg_settings_wal_compression label:<name:"server" value:"localhost:5432" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric pg_settings_wal_keep_segments label:<name:"server" value:"localhost:5432" > gauge:<value:0 >  was collected before with the same name and label values

Am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions