warp-prometheus

Crates.iowarp-prometheus
lib.rswarp-prometheus
version0.5.0
sourcesrc
created_at2021-04-07 20:05:30.943294
updated_at2021-10-18 14:02:31.58989
descriptionAn afterthought of prometheus metrics for Warp
homepage
repositoryhttps://github.com/calvinbrown085/warp-prometheus
max_upload_size
id380536
size18,787
Calvin Brown (calvinbrown085)

documentation

README

warp-prometheus

Afterthought of Prometheus metrics for Warp Docs Apache-2 licensed CI

Example

use prometheus::Registry;
use warp_prometheus::Metrics;
use warp::Filter;

let registry: Registry = Registry::new();
let path_includes: Vec<String> = vec![String::from("hello")];

let route_one = warp::path("hello")
    .and(warp::path::param())
    .and(warp::header("user-agent"))
    .map(|param: String, agent: String| {
    format!("Hello {}, whose agent is {}", param, agent)
    });

    let metrics = Metrics::new(&registry, &path_includes);

    let test_routes = route_one.with(warp::log::custom(move |log| {
        metrics.http_metrics(log)
    }));
Commit count: 18

cargo fmt