Skip to content

fix: disable pg_settings scrape when --disable-default-metrics is set#1276

Open
ricardbejarano wants to merge 1 commit intoprometheus-community:masterfrom
bejaratommy:fix/disable-default-metrics-skips-pg-settings
Open

fix: disable pg_settings scrape when --disable-default-metrics is set#1276
ricardbejarano wants to merge 1 commit intoprometheus-community:masterfrom
bejaratommy:fix/disable-default-metrics-skips-pg-settings

Conversation

@ricardbejarano
Copy link
Copy Markdown

Description

Fixes #712

When --disable-default-metrics is passed, users reasonably expect that all default metrics—including the pg_settings view—are skipped. Previously, only --disable-settings-metrics would suppress the pg_settings query; --disable-default-metrics had no effect on it.

This change makes --disable-default-metrics imply skipping pg_settings, by ORing the two flags when calling server.Scrape.

Changes

  • exporter/datasource.go: pass e.disableSettingsMetrics || e.disableDefaultMetrics to server.Scrape instead of just e.disableSettingsMetrics

Testing

Existing unit tests pass. The bug was confirmed by users running with --disable-default-metrics and observing Querying pg_setting view debug lines in the logs.

When --disable-default-metrics is passed, pg_settings should also be skipped. Previously, only --disable-settings-metrics would suppress the pg_settings query. This change makes --disable-default-metrics imply disabling pg_settings as well, which matches user expectations. Fixes prometheus-community#712 Signed-off-by: Tommy <tommy@bejarano.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant