Skip to content

Latest commit

 

History

History

_example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

pgx-prometheus example

This example shows how to use pgx-prometheus to instrument a PostgreSQL server using pgxpool.

Prerequisites

Running the example

  1. 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:15-alpine
  1. Run the example:
go run example.go
  1. Open http://localhost:8080/metrics in your browser to see the metrics.