Fixed
-
The
statementscollector decided whether to filter ontoplevelwith a catalog
probe that it cached for the life of the process, and that looked at the
pg_stat_statementsview while the scrape reads the function. That could:- fail every scrape with
column s.toplevel does not exist(503) after the extension
was dropped and created again at 1.8, until the exporter was restarted; - keep reading without the filter after
ALTER EXTENSION pg_stat_statements UPDATE
from a version older than 1.9, until the exporter was restarted; - drop the filter when a relation called
pg_stat_statementscame earlier in
search_path, or when the role could not readpg_attribute.
Without the filter, under
pg_stat_statements.track = alla statement that only runs
inside a function was exported, and one that runs both ways had its two entries
overwrite each other. The filter is now part of the scrape query: aNATURAL JOINon
toplevelkeeps only top-level rows wherever the function returns that column, and
every row on 1.8, which has none. There is no probe left to go stale or to disagree
with the call it describes, and the scrape needs no catalog access beyond what 0.22.3
needed. - fail every scrape with
-
The
databasecollector failed whenever a scrape overlapped aDROP DATABASE.
pg_database_sizeraises an error for a database that was dropped after the statement
had listed it, and that error failed the collector for the scrape. When that happens
the databases are now read one by one, so only the one that vanished is left out. Where
PostgreSQL answers NULL for it instead (14, and a superuser up to 17), the catalog is
asked whether it still exists. The normal case is still a single statement. -
The same collector asked for each size by database name, which PostgreSQL looks up
a second time. A database dropped and created again under its name in between was
reported with the old connection limit and the new size. Sizes are now asked for by
the OID of the row that was listed, so both values describe one database (short of
recreating it with an explicitly chosen old OID in the middle of a scrape). -
pg_database_size_bytesreported 0 for a database whose size PostgreSQL answered as
NULL. An unknown size is no longer published as 0 bytes; the series is absent for
that scrape. -
pg_stat_user_tables_autovacuum_threshold_ratioand
pg_stat_user_tables_autoanalyze_threshold_ratiodid not follow the server's own
trigger point, in two ways:- They reported 0 for every table without live rows, which after a mass delete is
exactly the table that is due. Both are now computed for such tables. This also
makes the 0.22.3 note true for them: with a zero trigger point the ratio is the
tuple count. - The scaled part used the live-tuple counter. Autovacuum uses
reltuples, the row
estimate from the lastVACUUMorANALYZE, and so do the ratios now. The two
differ most right after a bulk delete or load: a 100-row table that was analyzed and
then emptied, with threshold 10 and scale factor 1, is at 100/110 = 0.91 of its
trigger point, not past it.
Values of both ratios change for tables whose row count moved since their last
vacuum or analyze, and an alert on them can now fire for emptied tables that it used
to miss. - They reported 0 for every table without live rows, which after a mass delete is
-
On PostgreSQL 18 and later the vacuum ratio honours
autovacuum_vacuum_max_threshold
(the table reloption or the server setting). It was ignored, which under-reported how
due a table is once the cap is lower thanthreshold + scale_factor * reltuples.
Security
- A release no longer pushes the container image before every build has succeeded.
The image job waited for the binaries only, sosha-<commit>could be public while
the crate build was still running, and it was pushed before it had been run. It now
waits for the crate too and runs the image before pushing it. - The release guard and
just releasetakeCI OKfrom the Test & Build workflow's own
jobs, and go by the one that completed last across runs and re-run attempts. They used
to accept the latest check namedCI OKon the commit, whoever published it, and an
earlier success could stand in for a later failure. just releasetells the workflow which commit it means, and the guard refuses any
other.developmoving between the two could otherwise release a commit the operator
had not looked at. The recipe also follows its own run by a request id, not "the
newest run of this commit".- crates.io is asked before the image is pushed, and again right before the release is
created: a version that already exists there with other bytes stops the run before
any tag or release exists. After the upload the publish job compares the checksum
crates.io reports with the.cratein the GitHub release. Any registry answer other
than "found" or "not found" is an error, not "not published yet". scripts/setup-local-test-db.shand the other helper scripts no longer print a DSN
in their messages; a password in the query string or a keyword was shown in clear
text. They name the destination host instead, and the setup script validates its
target before it prints anything about it.- The test suite checks where its database connection really goes, in the Rust tests,
inscripts/setup-local-test-db.shand for the containers tests start themselves. The
old guard looked forlocalhostanywhere in the DSN and did not seePGHOSTADDR, so
the suite, which drops databases and terminates backends, could be pointed at another
server while the DSN looked local. The devcontainer opt-in now admits itspostgres
service only, where it used to switch the guard off. - Test fixtures derive their isolated-database and role connections without the
dbname,userandpasswordquery parameters, which SQLx lets override the URL, and
verifycurrent_database()before use. With?dbname=inPG_EXPORTER_DSNa test
could change the caller's database and still pass.
Changed
-
Update
sysinfoto 0.40.4, which thesystemcollector and the exporter's own
process metrics are built on. It makes creating its system handle and reading the load
average fallible, so the collectors now create the handle on first use and handle
both failures instead of assuming success:- When the load average cannot be read,
pg_system_load1,pg_system_load5and
pg_system_load15keep their last values (0 if it never could be read) and a
warning is logged. A platform without load averages is skipped silently. - On a platform
sysinfodoes not support, the affected metrics are not updated and
each affected collector logs one warning.
Metric names and labels are unchanged, and so are the values on Linux, with one
possible exception:sysinfo0.40 keeps no/proc/<pid>/statdescriptor open for
the exporter's own process, sopg_exporter_process_open_fdsmay read one lower.
On FreeBSD
pg_system_memory_available_bytesrises: it now includes inactive and cache pages
and buffer space, where it used to equal free memory. - When the load average cannot be read,
-
Drop the unused
ipnetworkanduuidfeatures of SQLx. Nothing decoded those types,
and the features kept SQLx's MySQL and SQLite drivers in the lockfile. -
Update
builtto 0.9.0. It only runs at build time and still records the commit
hash that--versionand/healthreport. -
Remove the
nixdevelopment dependency; nothing used it.
Tests
- CI now exports the two-platform image as an OCI archive, checks that its index holds
both platforms and, for each, its own attestation with an SBOM and provenance, and
runs the amd64 image out of that archive. It used to leave the two-platform build in
the build cache and run a second, separate build. - The vacuum-progress test always cancels its throttled
VACUUMand drops its database,
also when a scrape fails; the issue 35 test checks eachsystemsub-collector on its
own; the standby reply-time test identifies the reply by its timestamp; and the
LazySystemtests pass on a host without asysinfobackend. - Make the issue 35 regression test deterministic. It checked that another task ran
while thesystemcollector was collecting, which is a race: on a busy host the
offloaded reads can finish before the collector is first suspended, and a correct
collector then never yields. Under full CPU load it failed about 1 run in 30, and now
thatCI OKgates a release, that blocks releases. The test now holds the runtime's
only blocking thread, so an offloading collector must yield and an inline one cannot.
Documentation
- Replication:
pg_replication_slots_pg_wal_lsn_diffon a standby is measured against
the last WAL received by streaming. A standby that never streamed reports 0, and one
that switched from streaming to the archive keeps measuring against its last streamed
position. - Statements: the metric names in the README carry the
postgres_prefix they are
exported with; the PromQL examples returned nothing as written. - Statements: of the measures against secrets in
query_short, only
--statements.query-text-refresh=0rules exposure out; the two server-side ones are
prospective and partial, and nothing removes a label Prometheus already stored. - Releasing: Dependabot security updates target
mainwhatever the configuration says,
and have to be applied onsandbox.
Full changelog: 0.22.3...0.22.4
Container image
podman pull ghcr.io/nbari/pg_exporter:0.22.4Digest: sha256:bc0f5348a33af17e8dd6bc17aabdb5bf1c9c2887dd5e98af98f03c8ab8fefaf6
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.4 --repo nbari/pg_exporter --signer-workflow nbari/pg_exporter/.github/workflows/release.ymlBuilt with Rust 1.100.1.