Repository navigation
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_nameat connection startup. Every PostgreSQL pool connection sends the name resolved bylib/pqin the startup packet (application_namein the URL,PGAPPNAME, orfallback_application_name, defaulting topg_exporterwhen 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.
postgresPrecheckfoldspg_catalog.current_setting('server_version_num')::intinto the metadataSELECTunder a single--connect-timeoutbudget. Auto-discovered peripheral servers omit thepg_databasesubquery and discovery diff (postgresForkedMetadataSQL). On precheck failure,pg_upbecomes0and the server retains its previous version and plan. - Stagger connection pool recycling across 10–12 minutes. Pool
connMaxLifeTimeincreases from1mto10mplus 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 aspg_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 (42501catalog ACL revocation, login failure, metadata timeout, or fatal collector failure),/metricsreportspg_up 0while previously discovered databases still emit fresh metrics. Shared-endpoint dial failures and57P03(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, andpg_seqread PostgreSQL statistics views so revokingPUBLICSELECTonpg_catalog.pg_indexorpg_catalog.pg_sequencedoes not drop relation metrics;pg_tablealso removes nine unusedDISCARDcolumns. Top-256 / Top-512 / Top-128 sampling breaks ties by ascending OID (legacy/config/also gains the table and index OID tie-breakers), andpg_seqexcludes other sessions' temp schemas and publishesNaNforpg_seq_last_valuewhile preserving block counters when lacking sequenceUSAGEorSELECT. - Support PgBouncer 1.8 two-part versions and 1.26+ login statistics.
ParseSemveraccepts PgBouncer 1.8's two-partSHOW VERSIONoutput, fixing/metricsHTTP 500 responses. Both regular and legacy bundles addpgbouncer_stat_126(min_version: 12600, 25 columns) and cappgbouncer_stat_124atmax_version: 12600, exposingpgbouncer_stat_total_client_login_count(counter) andpgbouncer_stat_avg_client_login_count(gauge) labeled bydatname. - Negotiate Prometheus text 1.0.0, reload
rate_limitlive, and follow.yml/.yamldirectory symlinks./metricsservestext/plain; version=1.0.0on explicitAccept(0.0.4default),rate_limitedits in--web.config.fileapply on the next request (exporter-toolkitv0.21.0), config directories follow.yml/.yamldirectory symlinks while skipping cycles with a warning, equal-priority collectors order by branch name, missing scalar columns warn once per query,make -j releaseisolates per-arch build staging, andpg_exporter/exporterencapsulates package state with terminalClose()semantics and AST architecture guards.
Upgrade notes
- 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 thepg_table,pg_index,pg_seq, andpgbouncer_stat_126updates. For custom PgBouncer configurations, addpgbouncer_stat_126and setmax_version: 12600onpgbouncer_stat_124, then reload viasystemctl reload pg_exporterorPOST /reload. - 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 LIMITto at least 7 (or higher when multiple exporters share the role) on instances with three or more discovered databases. - 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
USAGEorSELECTreportpg_seq_last_valueasNaNwhile preserving I/O counters. - Update Go callers if importing
pg_exporter/exporter. Pass an explicit DSN and config toNewExporter, use(*Exporter).Reload()/(*Exporter).ReloadFuncandSetLogger(), and create a new instance afterClose(). For PostgreSQL 9.1–9.6, downloadlegacy/pg_exporter.ymlfrom 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