Fixed
pg_replication_slots_pg_wal_lsn_diffreported 0 for every slot and
pg_stat_replication_reply_timereported 0 for every standby on PostgreSQL 14+.
Both values arenumericin PostgreSQL and were read asf64without a cast; the
failed decode was swallowed and replaced by 0, so the documented WAL-retention alert
could never fire. Both are now cast todouble precision, and a decode failure fails
the collector instead of publishing 0. A slot without reserved WAL and a standby
that has not replied yet still report 0.pg_wait_event_typeunder-reported any type with more than one distinct wait event.
The query returns one row per (type, event) and each row overwrote the gauge, so
three sessions waiting onLock/relationand one onLock/transactionid
exportedpg_wait_event_type{type="Lock"} 1instead of 4. Counts are now summed
per type.pg_wait_eventis summed the same way for an event name that exists
under two types (SyncRep).- A PostgreSQL major upgrade under a running exporter no longer needs an exporter
restart. The server version was detected once per process, so version-gated
collectors kept using the old server's SQL: after a 17 to 18 upgrade
--collector.stat_iofailed every scrape withcolumn "op_bytes" does not exist
(503), and after a 16 to 17 upgradepg_stat_checkpointer_*stayed absent. The
version is now read on every scrape, in the same round trip as the connectivity
check (SHOW server_version_numreplacesSELECT 1), and a change is logged. - After a PostgreSQL restart or failover, scrapes no longer report
pg_up 0while the
server is already accepting connections. Pooled connections were handed out without
validation, so each scrape drew one dead connection, failed its connectivity check,
and discarded it: up to one false outage per pooled connection (three). The
validation had been disabled together with a recovery pool that was later removed.
Idle connections are now checked on checkout and replaced within the same acquire,
at the cost of one extra round trip per checkout. --collector.statementsno longer fails every scrape whenpg_stat_statements
disappears under a running exporter (DROP EXTENSION, or a cut-over to a server
where it was never created). The collector cached "installed" without rechecking,
so its query failed withfunction pg_stat_statements(boolean) does not existand
the whole scrape returned 503 until restart. It now skips, clears its series, and
probes for the extension again after a minute.- A table whose reloptions set both
autovacuum_vacuum_thresholdand
autovacuum_vacuum_scale_factor(or the analyze pair) to 0 made thestatcollector
query fail withdivision by zero. Everypg_stat_user_tables_*series of that
database disappeared, and the scrape returned 503 when every database had such a
table. The divisor is now guarded. Such a table reports its dead (or modified) tuple
count as the ratio, so any pending work reads as at or past the threshold. pg_version_inforeported a version PostgreSQL does not use:short_versionwas
padded to three parts, so a 18.6 server showed as18.6.0in the dashboard's
Version panel (#42). The label is nowmajor.minor(18.6), taken from
server_version_num. A pre-release such as19beta1reports19.0; the full
string stays in theversionlabel. A rule that matches the three-part form
exactly, such asshort_version="18.6.0", must be updated; matches on the
major (short_version=~"18\\..*") keep working. The dashboard also trims the old
padding itself, so it shows18.6against an exporter older than this release.
The collector no longer runsSELECT version()twice per scrape.
Security
--helpand-hno longer print the value ofPG_EXPORTER_DSN. With a password
embedded in the DSN, help output showed it in clear text
([env: PG_EXPORTER_DSN=postgresql://user:password@...]); it now shows only the
variable name.- Refresh dependencies to clear the security audit: libz-sys 1.1.33
(RUSTSEC-2026-0418, RUSTSEC-2026-0544), url 2.5.9 (RUSTSEC-2026-0592), and
libsqlite3-sys 0.40.0 (RUSTSEC-2026-0459). None was reachable from the shipped
binary: libz-sys is a build-time dependency, libsqlite3-sys is only named in the
lockfile, and the affectedUrl::origin()is never called.
Changed
-
Update SQLx to 0.9.1, which sets
TCP_NODELAYon PostgreSQL sockets again. SQLx
0.9.0 dropped it, adding a ~40 ms stall to every new TLS connection; the
multi-database collectors (stat,index,sequences) open one connection per
database, so the cost grew with the database count. A TLS scrape of 50 databases
went from about 4.0 s to 0.7 s; plaintext connections were not affected. The same
release fixes a TLS close that could wait on the server indefinitely and a pool
idle-counter underflow. -
SQLx 0.9.1 changes three connection behaviours:
- The TLS configuration is built once per process instead of once per connection.
Rotatedsslrootcert,sslcert, orsslkeyfiles are picked up after an
exporter restart, no longer on the next connection. hostaddrno longer replaceshost. With both set,hostis used for TLS
server-name verification and.pgpasslookup, andhostaddronly for the TCP
connection.PGHOSTADDRis applied even when the DSN names a host.
The
--collector.systemremote-database startup warning followshostaddras
well, sohost=localhost&hostaddr=10.0.0.5is still recognised as remote. It also
recognises a bracketed IPv6 loopback host ([::1]) as local. - The TLS configuration is built once per process instead of once per connection.
-
Refresh the remaining compatible dependencies, including clap 4.6.10, tonic 0.14.9,
and hyper 1.13.0. -
Replace
chronowithjifffor the certificate-expiry arithmetic in thetls
collector, the only place a date-time crate is used.chronois flagged as
unmaintained (RUSTSEC-2026-0543) and is no longer compiled into the binary;jiffis
built without its time zone database, since only UTC instants are needed.chrono
still appears inCargo.lockas an optional dependency of SQLx, socargo audit
keeps listing that warning. -
Use
Option::map_or_defaultwhere Rust 1.100 Clippy now requires it. -
Releases now go through one workflow run that builds the commit CI already tested;
see RELEASING.md.just releasereplacesjust deploy, and pushing a
tag no longer starts anything: the tag is created by publishing the GitHub release,
after every build succeeded.just bumpmoves to the work branch and no longer
pushes. What this changes for users of a release:- Release files gain
SHA256SUMS, the.crate, and a build-provenance attestation
for every file and for the container image. - The container image is made from the same two binaries as the release archives
(the newprebuiltstage of theContainerfile) instead of being compiled a
second time under emulation. Building theContainerfileyourself is unchanged. - The crate is published with crates.io Trusted Publishing instead of a stored token.
- Release files gain
-
CI now also builds the aarch64 binary, the
.deband.rpmand the two-platform
container image (which it runs), and runscargo packageand a publish dry run on
every push. It reports one aggregateCI OKcheck. -
Every GitHub Action is pinned to a commit and the Rust toolchain is installed with
rustup directly instead of a third-party action. Dependabot proposes action, crate
and Dev Container updates as pull requests intosandbox.
Tests
- Add PostgreSQL 19 to the CI matrix and to
just test-all-pg. The suite passes on 19
unchanged, with every collector enabled and no metric family missing compared to 18. - The primary/replica topology test now takes its image tag from
PG_EXPORTER_TEST_POSTGRES_TAGlike the other container tests, so the CI matrix
exercises replication on every supported major instead of always on 16. - Fix two races between tests that share one PostgreSQL. The on-CPU backend test ran
generate_series(1, 2000000000)inFROM, which spills to disk at about 300 MB/s
and kept running after the test ended, so the cluster-wide temp-file test could see
tens of gigabytes that never shrank; the series is now streamed from theSELECT
list and bounded bystatement_timeout. The database catalog test rejected
datconnlimit = -2, which PostgreSQL sets while a database is being dropped. - Fix a third race, in the vacuum-progress test that follows a
VACUUMin another
database. It set its cost throttle through the pool and ran theVACUUMthrough the
pool too, so the two could land on different connections: theVACUUMthen ran
unthrottled and the test passed only when it caught a short vacuum in flight. Both
now share one connection, and the throttledVACUUMis cancelled once it was seen. - Cover the
short_versionfix (#42) on both sides: the collector tests compare the
label withserver_version_numandserver_versionof the live server, and a
dashboard test applies the Version panel's ownlabel_replacepattern to old
(18.6.0) and new (18.6,18.0) label values.
Documentation
- Statements: document that
query_shortcan republish a secret from a utility
statement such asCREATE ROLE ... PASSWORD '...', and how to rule it out. Correct
the claim that utility statements have no query text. - Sequences: document that the collector needs
SELECTon the sequences it watches
(pg_monitoralone exports nothing), and that it holds one lock per sequence, which
can exhaust the lock table in databases with many thousands of sequences. - Database: document that
--exclude-databasesalso narrows the cluster-wide connection
totals of theactivitycollector and drops the shared-objects row of
pg_stat_database_*.
Full changelog: 0.22.2...0.22.3
Container image
podman pull ghcr.io/nbari/pg_exporter:0.22.3Digest: sha256:25ee080ddf59e30b0325a8b1b9785795791d0e276c182fce2178343b70667941
Verify a download
sha256sum --check --ignore-missing SHA256SUMS
gh attestation verify <file> --repo nbari/pg_exporter --signer-workflow nbari/pg_exporter/.github/workflows/release.yml
gh attestation verify oci://ghcr.io/nbari/pg_exporter:0.22.3 --repo nbari/pg_exporter --signer-workflow nbari/pg_exporter/.github/workflows/release.ymlBuilt with Rust 1.100.0.