github prometheus-community/postgres_exporter v0.21.0
0.21.0 / 2026-11-17

2 hours ago

WARNING: upgrading with large counters can cause a one-time false rate spike.
Non-negative 64-bit counters are now wrapped at 2^53 by default so that
single-unit changes remain representable as float64. On the first scrape
after an upgrade, a previous value such as 2^53 + 1,234,567 becomes
1,234,567. Prometheus interprets that decrease as a counter reset and counts
the remainder as post-reset growth, so rate() and increase() can report a
large false spike for that evaluation window. Use
--no-wrap-large-counters to preserve the previous conversion during rollout;
enabling wrapping later will still create this one-time reset boundary.

DEPRECATION: the DATA_SOURCE_* environment variables that now have a flag.
Each one below keeps working and still takes effect when its flag is unset, but
the exporter logs a warning on startup and they will be removed in v0.22.0.

Deprecated env var Replacement
DATA_SOURCE_URI --datasource.uri
DATA_SOURCE_URI_FILE --datasource.uri-file
DATA_SOURCE_USER_FILE --datasource.user-file
DATA_SOURCE_PASS_FILE --datasource.pass-file

DATA_SOURCE_NAME, DATA_SOURCE_USER and DATA_SOURCE_PASS are not
deprecated and get no flag: they carry secrets, and CLI flags are readable via
/proc and the Kubernetes API. Pass those by environment variable, or point
the -file flags at a mounted secret.

DEPRECATION: the PG_EXPORTER_* environment variables.
Each one below keeps working and still takes effect when its flag is unset, but
the exporter logs a warning on startup naming the flag to use instead. They
will be removed in v0.22.0.

Deprecated env var Replacement
PG_EXPORTER_WEB_TELEMETRY_PATH --web.telemetry-path
PG_EXPORTER_DISABLE_DEFAULT_METRICS --disable-default-metrics
PG_EXPORTER_AUTO_DISCOVER_DATABASES --auto-discover-databases
PG_EXPORTER_EXTEND_QUERY_PATH --extend.query-path
PG_EXPORTER_CONSTANT_LABELS --constantLabels
PG_EXPORTER_EXCLUDE_DATABASES --exclude-databases
PG_EXPORTER_INCLUDE_DATABASES --include-databases
PG_EXPORTER_METRIC_PREFIX --metric-prefix
PG_EXPORTER_COLLECTION_TIMEOUT --collection-timeout
  • [CHANGE] Add --datasource.* CLI flags for the Postgres connection config and deprecate the DATA_SOURCE_* environment variables they replace by @nicolastakashi in #1376
  • [CHANGE] Wrap non-negative 64-bit counters at 2^53 to preserve single-unit precision by @gnanirahulnutakki in #1351
  • [CHANGE] Enforce concurrent scrape limits through --web.max-requests (default 40), independently for the metrics and /probe endpoints, by @ArthurSens in #1428. Previously, both endpoints allowed unlimited concurrent scrapes. After upgrading, requests exceeding the limit receive HTTP 503; multi-target deployments share one limit across all /probe targets, so setups that probe many targets can hit it. Set --web.max-requests=0 to preserve the previous unlimited behavior.
  • [CHANGE] stat_replication: add pid label to disambiguate replication connections that otherwise share identical labels by @sysadmind in #1353
  • [CHANGE] stat_activity_autovacuum: add datname and schemaname labels to disambiguate autovacuum workers that otherwise share a relname by @spicysharkco in #1419
  • [CHANGE] Deprecate PG_EXPORTER_WEB_TELEMETRY_PATH for removal in v0.22.0; use --web.telemetry-path instead, by @ArthurSens in #1428. Until removal, the environment variable continues to set the metrics path when the flag is unset and logs a startup warning.
  • [CHANGE] Deprecate the remaining PG_EXPORTER_* environment variables for removal in v0.22.0 in favor of their flags, with a startup warning when one is used, by @adityareddy-dev in #1451
  • [CHANGE] Drop all metrics from a collector that fails part way through a scrape, by @pujitha24 in #1401. Previously, the metrics collected before the error were still exposed. The failure is still reported by pg_scrape_collector_success.
  • [CHANGE] Run the database-scoped collectors (stat_user_tables, statio_user_tables and statio_user_indexes) against every configured database, and against every discovered database with --auto-discover-databases, by @mwimpelberg28 in #1378. Previously, they only ran against the first one. This can noticeably increase the number of series on multi-database setups. statio_user_indexes metrics gain a datname label.
  • [FEATURE] Add --web.disable-exporter-metrics to exclude Go, process, and postgres_exporter_build_info metrics while retaining PostgreSQL scrape-status and configuration-reload metrics, by @ArthurSens in #1428, based on @nicolastakashi's work in #1368.
  • [FEATURE] Export pg_settings.pending_restart as pg_settings_pending_restart{name} from the settings collector by @MarcWort in #1396
  • [FEATURE] replication_slots: export conflicting, inactive_since, failover and synced from pg_replication_slots on PostgreSQL 17+ by @abd-ulbasit in #1421
  • [FEATURE] Reload the configuration file without restarting, through POST /-/reload or SIGHUP; if a reload fails, the last good configuration stays in use, by @Chaithanyanallamothu in #1406
  • [FEATURE] Make the exporter embeddable as a Go library: collector.Runtime runs the collectors of one exporter instance and the config package holds its configuration, by @ArthurSens in #1330
  • [FEATURE] Add aurora_replica_status collector for Amazon Aurora PostgreSQL by @megative in #1311
  • [FEATURE] Add aurora_global_db_status collector for Amazon Aurora PostgreSQL by @megative in #1410
  • [FEATURE] Add aurora_stat_logical_wal_cache collector for Amazon Aurora PostgreSQL by @megative in #1414
  • [FEATURE] Add aurora_stat_database collector for Amazon Aurora PostgreSQL by @megative in #1425
  • [FEATURE] Add aurora_global_db_instance_status collector for Amazon Aurora PostgreSQL by @megative in #1411
  • [FEATURE] Add aurora_stat_get_db_commit_latency collector for Amazon Aurora PostgreSQL by @megative in #1413
  • [FEATURE] Add aurora_stat_dml_activity collector for Amazon Aurora PostgreSQL by @megative in #1412
  • [FEATURE] Add aurora_stat_bgwriter collector for Amazon Aurora PostgreSQL by @megative in #1426
  • [FEATURE] Add aurora_stat_optimized_reads_cache collector for Amazon Aurora PostgreSQL by @megative in #1427
  • [FEATURE] Add aurora_instance collector for Amazon Aurora PostgreSQL by @megative in #1433
  • [ENHANCEMENT] Allow running without a configuration file: an empty --config.file disables auth modules and avoids misleading startup warnings in single-target mode, by @ArthurSens in #1370
  • [ENHANCEMENT] Update github.com/lib/pq to v1.12.3, which adds support for sslmode=prefer, sslmode=allow and target_session_attrs, by @RajeshRajendiran in #1349
  • [ENHANCEMENT] Include the LICENSE and NOTICE files in the container image by @locker95 in #1380
  • [BUGFIX] Add unit-correct pg_database_wraparound_age_datfrozenxid and pg_database_wraparound_age_datminmxid gauges, by @je4yfc in #1417. The existing _seconds metrics remain as deprecated aliases with unchanged ID-count values; migrate dashboards, rules, and alerts to the new names.
  • [BUGFIX] Fix long_running_transactions to count only transactions older than a configurable threshold, by @ArthurSens in #1379, based on the contribution by @moreinhardt in #1210
  • [BUGFIX] Fix the wal collector failing on every scrape on Amazon Aurora PostgreSQL versions that don't support pg_ls_waldir() by @megative in #1312
  • [BUGFIX] Fix the replication collector failing on every scrape on Amazon Aurora PostgreSQL, where it now reports only pg_replication_is_replica, by @megative in #1424, based on the contribution by @dannotripp in #1274
  • [BUGFIX] Fix key=value DSNs that contain = in a value: such a password is now redacted in logs, and options='-c statement_timeout=5000' now works for auto-discovered databases and /probe targets by @abd-ulbasit in #1423
  • [BUGFIX] Redact passwords from logged connection errors: errors from the URL parser and the lib/pq driver quote the connection string and were logged as is, by @sysadmind in #1409
  • [BUGFIX] Redact secrets passed as query string parameters, such as ?password=..., in logged DSNs by @sysadmind in #1389
  • [BUGFIX] Apply --collection-timeout to the legacy exporter, including custom queries from --extend.query-path, so that slow queries no longer pile up across scrapes, by @maltere in #1393
  • [BUGFIX] stat_activity_autovacuum: skip autovacuum workers whose xact_start is NULL instead of failing the whole collector, by @locker95 in #1381
  • [BUGFIX] stat_database: report errors raised while reading query results instead of ignoring them, by @chieflibrarian in #1399

Don't miss a new postgres_exporter release

NewReleases is sending notifications on new releases.