5 releases (breaking)

0.5.0 Oct 18, 2021
0.4.0 Apr 14, 2021
0.3.0 Apr 13, 2021
0.2.0 Apr 13, 2021
0.1.0 Apr 7, 2021

#1500 in HTTP server

Download history 195/week @ 2024-12-17 8/week @ 2024-12-24 223/week @ 2024-12-31 288/week @ 2025-01-07 335/week @ 2025-01-14 248/week @ 2025-01-21 339/week @ 2025-01-28 522/week @ 2025-02-04 358/week @ 2025-02-11 230/week @ 2025-02-18 378/week @ 2025-02-25 222/week @ 2025-03-04 768/week @ 2025-03-11 371/week @ 2025-03-18 402/week @ 2025-03-25 447/week @ 2025-04-01

2,042 downloads per month

Apache-2.0

8KB
91 lines

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)
    }));

Dependencies

~11–22MB
~305K SLoC