Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 640 Bytes

prom.md

File metadata and controls

22 lines (16 loc) · 640 Bytes

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.