prometheus-community / prometheus-community/postgres_exporter

Deprecate environment variable configuration in favor of CLI flags

Open
#1,371 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

go help wanted
Dominant language
Go
Stars
3.6k
Forks
835
Avg merge
2d 4h
Merged PRs (30d)
10

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by auditing the flag definitions and the environment-variable fallbacks listed in the issue, then read exporter/datasource.go:GetDataSources() for connection configuration. Inspect the prometheus-community/helm-charts postgres-exporter templates/deployment.yaml separately. Done means the deprecation path is defined for all listed variables, CLI coverage is addressed, and the chart migration is coordinated for removal after two releases.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, helm, postgresql
Domain
cli, databases, devops
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.