github pgsty/pg_exporter v1.7.0
pg_exporter-v1.7.0

58 minutes ago

PG Exporter v1.7.0 was released on December 6, 2026. Built with Go 1.27.4 and lib/pq 1.12.3, this release streamlines PostgreSQL prechecks to one round trip, staggers connection recycling, scrapes up to four discovered databases concurrently, preserves database metrics across catalog permission failures, and adds PgBouncer 1.8 and 1.26+ support. Existing CLI flags, environment variables, HTTP routes, and PostgreSQL SQL metric names, label keys, types, and histogram buckets are unchanged.

Changes

  • Set application_name at connection startup. Every PostgreSQL pool connection sends the name resolved by lib/pq in the startup packet (application_name in the URL, PGAPPNAME, or fallback_application_name, defaulting to pg_exporter when empty), covering discovered databases and reconnects without overwriting operator names or leaving pooled sessions unnamed. PgBouncer admin connections retain the driver's settings.
  • Collapse PostgreSQL prechecks to one round trip. postgresPrecheck folds pg_catalog.current_setting('server_version_num')::int into the metadata SELECT under a single --connect-timeout budget. Auto-discovered peripheral servers omit the pg_database subquery and discovery diff (postgresForkedMetadataSQL). On precheck failure, pg_up becomes 0 and the server retains its previous version and plan.
  • Stagger connection pool recycling across 10–12 minutes. Pool connMaxLifeTime increases from 1m to 10m plus deterministic FNV-64a per-DSN jitter in [0, 2m), preventing synchronized 60-second reconnect bursts across discovered databases and keeping backends warm across 300-second collectors such as pg_table_size.
  • Bound concurrent scrapes and isolate database-local failures. After the main database finishes, up to four auto-discovered peripheral databases collect concurrently on their dedicated single-connection pools (MaxConn = 1). When the main database hits a database-local error (42501 catalog ACL revocation, login failure, metadata timeout, or fatal collector failure), /metrics reports pg_up 0 while previously discovered databases still emit fresh metrics. Shared-endpoint dial failures and 57P03 (cannot_connect_now) across all configured hosts skip peripheral databases for that pass.
  • Read table, index, and sequence statistics through standard views and break ties by OID. pg_table (all four branches), pg_index, and pg_seq read PostgreSQL statistics views so revoking PUBLIC SELECT on pg_catalog.pg_index or pg_catalog.pg_sequence does not drop relation metrics; pg_table also removes nine unused DISCARD columns. Top-256 / Top-512 / Top-128 sampling breaks ties by ascending OID (legacy/config/ also gains the table and index OID tie-breakers), and pg_seq excludes other sessions' temp schemas and publishes NaN for pg_seq_last_value while preserving block counters when lacking sequence USAGE or SELECT.
  • Support PgBouncer 1.8 two-part versions and 1.26+ login statistics. ParseSemver accepts PgBouncer 1.8's two-part SHOW VERSION output, fixing /metrics HTTP 500 responses. Both regular and legacy bundles add pgbouncer_stat_126 (min_version: 12600, 25 columns) and cap pgbouncer_stat_124 at max_version: 12600, exposing pgbouncer_stat_total_client_login_count (counter) and pgbouncer_stat_avg_client_login_count (gauge) labeled by datname.
  • Negotiate Prometheus text 1.0.0, reload rate_limit live, and follow .yml/.yaml directory symlinks. /metrics serves text/plain; version=1.0.0 on explicit Accept (0.0.4 default), rate_limit edits in --web.config.file apply on the next request (exporter-toolkit v0.21.0), config directories follow .yml/.yaml directory symlinks while skipping cycles with a warning, equal-priority collectors order by branch name, missing scalar columns warn once per query, make -j release isolates per-arch build staging, and pg_exporter/exporter encapsulates package state with terminal Close() semantics and AST architecture guards.

Upgrade notes

  1. Upgrade the binary and merge collector YAML. Deploy the updated pg_exporter.yml (58 YAML files, 97 branches, 59 namespaces, and 462 distinct metric definitions) to pick up the pg_table, pg_index, pg_seq, and pgbouncer_stat_126 updates. For custom PgBouncer configurations, add pgbouncer_stat_126 and set max_version: 12600 on pgbouncer_stat_124, then reload via systemctl reload pg_exporter or POST /reload.
  2. Check monitoring role connection limits on multi-database instances. With up to 3 connections in the main PostgreSQL pool and up to 4 concurrent discovered database scrapes, raise CONNECTION LIMIT to at least 7 (or higher when multiple exporters share the role) on instances with three or more discovered databases.
  3. Review Top-N boundary ties and sequence grants. Ascending OID tie-breaking at the 256/512/128 cutoffs can shift tied boundary series on upgrade. Sequences without USAGE or SELECT report pg_seq_last_value as NaN while preserving I/O counters.
  4. Update Go callers if importing pg_exporter/exporter. Pass an explicit DSN and config to NewExporter, use (*Exporter).Reload() / (*Exporter).ReloadFunc and SetLogger(), and create a new instance after Close(). For PostgreSQL 9.1–9.6, download legacy/pg_exporter.yml from tag v1.7.0 (39 files, 61 branches, 38 namespaces, 299 distinct metric definitions). See compatibility for the migration table.

Verification scope

Tag v1.7.0 points to 364287d. Its CI run and Release run passed module and generated-config parity checks, the full -race suite, Go 1.21 HTTP mux compatibility tests, go vet, golangci-lint, AST architecture guards, six-target cross-builds, scratch container CA/TLS verification, restricted-role Docker collection and discovery recovery tests, and multi-arch package/image publication.

Release verification covers all 12 published archives and packages plus SHA-256 checksums, RPM installation on Rocky Linux 9 and DEB installation on Debian 12, and non-superuser monitor live scrapes across PostgreSQL 10–19.0 primaries, PostgreSQL 18 and 19 streaming standbys, PostgreSQL 9.1–9.6 with legacy/pg_exporter.yml, and PgBouncer 1.8 and 1.26.1, including Prometheus 0.0.4/1.0.0 negotiation, pooled startup application_name, revoked pg_index/pg_sequence/pg_extension catalog grants, and 25-database concurrent collection under pgbench load. The experimental snort components are not part of v1.7.0.

Downloads: use the release assets below and verify them with checksums.txt.

Full changelog · English documentation · Chinese release notes

Don't miss a new pg_exporter release

NewReleases is sending notifications on new releases.