| Crates.io | pgx_prometheus_exporter |
| lib.rs | pgx_prometheus_exporter |
| version | 0.0.1-alpha |
| created_at | 2023-02-06 20:34:00.851397+00 |
| updated_at | 2023-02-06 20:34:00.851397+00 |
| description | Rust extension for exporting prometheus metrics |
| homepage | https://www.coredb.io |
| repository | https://github.com/CoreDB-io/coredb |
| max_upload_size | |
| id | 778234 |
| size | 8,532 |
Proof-of-concept
If you have not already ran this on your machine, run it now:
cargo pgx init
Enable autoloading of the extension. Note, data-14 refers to the configuration for Postgres version 14. If you are using a different version, replace data-14 with the appropriate configuration name, e.g. data-13 for Postgres 13.
echo "shared_preload_libraries = 'prometheus_exporter.so'" >> ~/.pgx/data-14/postgresql.conf
Compile and run the extension on Postgres 14. This will start Postgres on port 28814. A metrics server will be running on localhost:8080.
cargo pgx run pg14
Scrape Prometheus metrics:
curl localhost:8080/metrics
# HELP pg_uptime Postgres server uptime.
# TYPE pg_uptime gauge
pg_uptime{} 57
# EOF
Runs tests:
cargo pgx test