pgbouncer-exporter broken in master
The pgbouncer-exporter is currently broken in master. When attempting to start it throws this error:
FATA[0000] driver: bad connection source="collector.go:50"
From the pgbouncer logs we can see it fail trying to run a query:
ERROR invalid command 'SELECT 'lib/pq ping test';', use SHOW HELP;
pgbouncer_1 | 2019-07-10_16:27:42.92995 2019-07-10 16:27:42.929 13971 WARNING C-0x1f812b0: pgbouncer/pgbouncer@unix(16389):6432 Pooler Error: invalid command 'SELECT 'lib/pq ping test';', use SHOW HELP;
pgbouncer_1 | 2019-07-10_16:27:42.93006 2019-07-10 16:27:42.929 13971 LOG C-0x1f812b0: pgbouncer/pgbouncer@unix(16389):6432 closing because: client close request (age=0)
The query is the new 'ping' that was added to lib/pg here: https://github.com/lib/pq/pull/737 and brought in with the latest pgbouncer-exporter version. The problem here is that our exporter is connecting to the pg bouncer admin database. Which isn't a true proper psql db, and you can't execute a SELECT like that there.
Our connection string:
/opt/gitlab/embedded/bin/pgbouncer_exporter --pgBouncer.connectionString="user=pgbouncer dbname=pgbouncer sslmode=disable port=6432 host=/var/opt/gitlab/pgbouncer" --web.listen-address="localhost:9188"
One possible fix might be to drop the ping in the pg-bouncer exporter: https://github.com/stanhu/pgbouncer_exporter/blob/ebc5807a569cec0a3e0cd155bb027e1cb2d79f02/collector.go#L166