mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-20 10:41:35 +02:00
8797329225
Co-authored-by: Andrew Hauck <ahauck@cloudflare.com> Co-authored-by: Edward Wang <ewang@cloudflare.com>
640 B
640 B
Prometheus
Pingora has a built-in prometheus HTTP metric server for scraping.
...
let mut prometheus_service_http = Service::prometheus_http_service();
prometheus_service_http.add_tcp("0.0.0.0:1234");
my_server.add_service(prometheus_service_http);
my_server.run_forever();
The simplest way to use it is to have static metrics.
static MY_COUNTER: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!("my_counter", "my counter").unwrap()
});
This static metric will automatically appear in the Prometheus metric endpoint.