serwus 0.2.3

Helpers for building actix-web/diesel based services
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use actix_web::HttpRequest;
use lazy_static::lazy_static;
use metrics_exporter_prometheus::{PrometheusBuilder, PrometheusHandle};

lazy_static! {
    pub static ref PROM_HANDLER: PrometheusHandle = PrometheusBuilder::new()
        .install_recorder()
        .expect("failed to install recorder");
}

pub async fn metrics(_: HttpRequest) -> String {
    PROM_HANDLER.render()
}