Skip to content

calvinbrown085/warp-prometheus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Prometheus metrics extention for Rust's Warp library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages