pingora/docs/user_guide/prom.md
Yuchen Wu 8797329225 Release Pingora version 0.1.0
Co-authored-by: Andrew Hauck <ahauck@cloudflare.com>
Co-authored-by: Edward Wang <ewang@cloudflare.com>
2024-02-27 20:25:44 -08:00

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.