SHOW STATS, SHOW POOLS) over the PostgreSQL wire protocol — there’s no native Prometheus or OTLP endpoint. To send these metrics to Axiom, run the Prometheus community’s pgbouncer_exporter next to PgBouncer, and an OpenTelemetry Collector that scrapes the exporter and forwards the metrics to Axiom.
The Prometheus receiver is part of the contrib distribution of the OpenTelemetry Collector (
otelcol-contrib). It isn’t included in the core distribution.Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to ingest data to the dataset you have created.
When you create the dataset, select Metrics as the dataset type. Metrics require their own dedicated dataset. For more information, see Create dataset.
Expose PgBouncer stats with pgbouncer_exporter
Inpgbouncer.ini, allow a user to read stats and let the exporter connect:
pgbouncer admin database:
PGBOUNCER_EXPORTER_CONNECTION_STRING environment variable. The exporter then serves metrics at http://localhost:9127/metrics.
Configure the OpenTelemetry Collector
Add a Prometheus receiver that scrapes the exporter and an OTLP/HTTP exporter that sends data to Axiom:Replace
AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.For metrics, use the x-axiom-metrics-dataset header instead of x-axiom-dataset.Query your metrics
Once data is flowing, query your PgBouncer metrics like any other OTel metrics in Axiom. Pool metrics carrydatabase and user tags. For example, to chart active client connections per database: