This example shows how to use pgx-prometheus to instrument a PostgreSQL server using pgxpool.
- Start a PostgreSQL server using Docker:
docker run --rm --name pgx-prometheus-example \
-p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=password \
postgres:19-alpine- Run the example:
go run example.go- Open http://localhost:8080/metrics in your browser to see the metrics.