Struct warp_prometheus::Metrics [−][src]
pub struct Metrics { /* fields omitted */ }
Implementations
Get prometheus metrics per-route and how long each route takes.
use prometheus::Registry;
use warp::Filter;
use warp_prometheus::Metrics;
let registry: &Registry = prometheus::default_registry();
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(®istry, &path_includes);
let test_routes = route_one.with(warp::log::custom(move |log| {
metrics.http_metrics(log)
}));
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Metrics
impl !UnwindSafe for Metrics
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more