#prometheus-metrics #warp #afterthought

warp-prometheus

An afterthought of prometheus metrics for Warp

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

#1093 in HTTP server

Download history 359/week @ 2024-07-19 414/week @ 2024-07-26 300/week @ 2024-08-02 244/week @ 2024-08-09 280/week @ 2024-08-16 398/week @ 2024-08-23 267/week @ 2024-08-30 115/week @ 2024-09-06 179/week @ 2024-09-13 218/week @ 2024-09-20 269/week @ 2024-09-27 267/week @ 2024-10-04 166/week @ 2024-10-11 232/week @ 2024-10-18 220/week @ 2024-10-25 199/week @ 2024-11-01

843 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–20MB
~291K SLoC