|
|
@ -172,7 +172,9 @@ impl CoreMetrics { |
|
|
|
port = port |
|
|
|
port = port |
|
|
|
); |
|
|
|
); |
|
|
|
tokio::spawn(async move { |
|
|
|
tokio::spawn(async move { |
|
|
|
warp::serve(warp::path!("metrics").map(move || { |
|
|
|
warp::serve( |
|
|
|
|
|
|
|
warp::path!("metrics") |
|
|
|
|
|
|
|
.map(move || { |
|
|
|
warp::reply::with_header( |
|
|
|
warp::reply::with_header( |
|
|
|
self.gather().expect("failed to encode metrics"), |
|
|
|
self.gather().expect("failed to encode metrics"), |
|
|
|
"Content-Type", |
|
|
|
"Content-Type", |
|
|
@ -181,7 +183,14 @@ impl CoreMetrics { |
|
|
|
// try text/plain to make web browsers happy.
|
|
|
|
// try text/plain to make web browsers happy.
|
|
|
|
"text/plain; charset=utf-8", |
|
|
|
"text/plain; charset=utf-8", |
|
|
|
) |
|
|
|
) |
|
|
|
})) |
|
|
|
}) |
|
|
|
|
|
|
|
.or(warp::any().map(|| { |
|
|
|
|
|
|
|
warp::reply::with_status( |
|
|
|
|
|
|
|
"go look at /metrics", |
|
|
|
|
|
|
|
warp::http::StatusCode::NOT_FOUND, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
})), |
|
|
|
|
|
|
|
) |
|
|
|
.run(([0, 0, 0, 0], port)) |
|
|
|
.run(([0, 0, 0, 0], port)) |
|
|
|
.await; |
|
|
|
.await; |
|
|
|
}) |
|
|
|
}) |
|
|
|