pgx_prometheus_exporter 0.0.1-alpha

Rust extension for exporting prometheus metrics
docs.rs failed to build pgx_prometheus_exporter-0.0.1-alpha
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

Postgres Extension to Export Promtheus Metrics

Proof-of-concept

Developer Setup

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

Testing

Runs tests:

cargo pgx test