diff --git a/crates/ptth_relay/src/scraper_api.rs b/crates/ptth_relay/src/scraper_api.rs
index ddb2e93..f448410 100644
--- a/crates/ptth_relay/src/scraper_api.rs
+++ b/crates/ptth_relay/src/scraper_api.rs
@@ -205,6 +205,22 @@ async fn api_v1 (
}
}
+#[instrument (level = "trace", skip (req, state))]
+async fn metrics (
+ req: Request
,
+ state: &Relay,
+)
+-> Result , RequestError>
+{
+ let mut s = String::with_capacity (4 * 1_024);
+ s.push_str ("# HELP forty_two Forty-two\n");
+ s.push_str ("# TYPE forty_two counter\n");
+ s.push_str ("forty_two 42\n");
+
+ Ok (Response::builder ()
+ .body (Body::from (s))?)
+}
+
#[instrument (level = "trace", skip (req, state))]
pub async fn handle (
req: Request ,
@@ -225,6 +241,9 @@ pub async fn handle (
else if let Some (rest) = path_rest.strip_prefix ("api/") {
api_v1 (req, state, rest).await
}
+ else if path_rest == "metrics" {
+ metrics (req, state).await
+ }
else {
Ok (error_reply (StatusCode::NOT_FOUND, strings::UNKNOWN_API_VERSION)?)
}