Description:
The exporter currently assumes that SHOW STATS in pgbouncer will always return legacy columns such as total_requests, avg_req, and avg_query which have been replaced by new fields. As a result, the exporter fails to run and collect metrics when connected to pgbouncer 1.8.x or later.
Steps to Reproduce:
-
Run pgbouncer ≥ 1.8.0 (tested with 1.22.x).
-
Deploy prometheus-pgbouncer-exporter pointing to this pgbouncer instance.
-
Observe a KeyError: 'total_requests' when attempting to run the exporter.
Expected Behavior:
Exporter should gracefully handle the updated SHOW STATS output and expose metrics that match the newer pgbouncer schema (or mark them as deprecated/absent in a backward-compatible way).
Proposed Solution:
-
Add version detection for pgbouncer and adapt query/metric mapping dynamically.
-
Provide feature flag or config option to allow running in "legacy mode" (pre-1.9) vs "modern mode" (1.9+).
-
Update documentation to reflect that 1.7.x is the last fully supported version until this fix is implemented.