From 7f5ab3cef57091e2fa1280e10875cdf9c3f950de Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Fri, 3 May 2024 12:29:31 +0100 Subject: [PATCH 1/2] Use http path pattern instead of full path in metrics --- meilisearch/src/middleware.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meilisearch/src/middleware.rs b/meilisearch/src/middleware.rs index 6707bb6d5..f3e665c29 100644 --- a/meilisearch/src/middleware.rs +++ b/meilisearch/src/middleware.rs @@ -59,10 +59,12 @@ where let request_path = req.path(); let is_registered_resource = req.resource_map().has_resource(request_path); if is_registered_resource { + let request_pattern = req.match_pattern(); + let metric_path = request_pattern.as_ref().map_or(request_path, String::as_str); let request_method = req.method().to_string(); histogram_timer = Some( crate::metrics::MEILISEARCH_HTTP_RESPONSE_TIME_SECONDS - .with_label_values(&[&request_method, request_path]) + .with_label_values(&[&request_method, metric_path]) .start_timer(), ); } From 3698aef66bdf3b1bca2ad3b7a3362712e9dbd6b7 Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 6 May 2024 11:36:37 +0200 Subject: [PATCH 2/2] fix warning --- meilisearch/src/routes/mod.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/meilisearch/src/routes/mod.rs b/meilisearch/src/routes/mod.rs index 7cf886017..a2fceb764 100644 --- a/meilisearch/src/routes/mod.rs +++ b/meilisearch/src/routes/mod.rs @@ -376,12 +376,6 @@ async fn get_version( }) } -#[derive(Serialize)] -struct KeysResponse { - private: Option, - public: Option, -} - pub async fn get_health( req: HttpRequest, index_scheduler: Data,