prometheus_exporter
Helper libary to export prometheus metrics using hyper.
It uses rust-prometheus for collecting and rendering the prometheus metrics and hyper for exposing the metrics through http.
Add this to your Cargo.toml:
[]
= "0.1"
The usage is pretty simple. First you register all your metrics with the provided macros:
let connection_state = register_int_gauge_vec!
.expect;
That is also where the metric values get updated:
connection_state
.with_label_values
.set;
After all the metrics are registerd and the updating is setup the exporter can be started:
use SocketAddr;
let addr: SocketAddr = "0.0.0.0:19899".parse.expect;
run;
This will block the thread it is executed in.
In the future the exporter will also provide a way to update the metrics when a new request comes in but that still needs to be implemented.