Aller au contenu
login
arrow_backRetour aux issues
prometheus-community/postgres_exporter #1371

Deprecate environment variable configuration in favor of CLI flags

ecoDébutant help wanted go

descriptionDescription

**Summary** `postgres_exporter` supports env-var configuration in two ways. We want to move fully to CLI flags, deprecate the env vars, and remove them after 2 releases. **Current state** 1. Flags with an `Envar()` fallback, settable via flag or env var. Kingpin doesn't record which one was used: `PG_EXPORTER_WEB_TELEMETRY_PATH`, `PG_EXPORTER_DISABLE_DEFAULT_METRICS`, `PG_EXPORTER_AUTO_DISCOVER_DATABASES`, `PG_EXPORTER_EXTEND_QUERY_PATH`, `PG_EXPORTER_CONSTANT_LABELS`, `PG_EXPORTER_EXCLUDE_DATABASES`, `PG_EXPORTER_INCLUDE_DATABASES`, `PG_EXPORTER_METRIC_PREFIX`, `PG_EXPORTER_COLLECTION_TIMEOUT`. Each already has a matching CLI flag (several already marked DEPRECATED for other reasons). 2. Env-var-only settings with no CLI flag (`exporter/datasource.go:GetDataSources()`): `DATA_SOURCE_NAME`, `DATA_SOURCE_USER(_FILE)`, `DATA_SOURCE_PASS(_FILE)`, `DATA_SOURCE_URI(_FILE)`. This is the Postgres connection config, and there's no flag today for setting it. 3. The `prometheus-community/helm-charts` postgres-exporter chart sets `DATA_SOURCE_NAME`, `DATA_SOURCE_URI(_FILE)`, `DATA_SOURCE_USER(_FILE)`, and `DATA_SOURCE_PASS(_FILE)` directly as container env vars in `templates/deployment.yaml`, confirmed against the chart's current `main` branch. It has no equivalent flag-based path and will need updating in that separate repo.
codeOuvre sur GitHub