mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
Use http path pattern instead of full path in metrics
This commit is contained in:
parent
248e22005a
commit
7f5ab3cef5
@ -59,10 +59,12 @@ where
|
|||||||
let request_path = req.path();
|
let request_path = req.path();
|
||||||
let is_registered_resource = req.resource_map().has_resource(request_path);
|
let is_registered_resource = req.resource_map().has_resource(request_path);
|
||||||
if is_registered_resource {
|
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();
|
let request_method = req.method().to_string();
|
||||||
histogram_timer = Some(
|
histogram_timer = Some(
|
||||||
crate::metrics::MEILISEARCH_HTTP_RESPONSE_TIME_SECONDS
|
crate::metrics::MEILISEARCH_HTTP_RESPONSE_TIME_SECONDS
|
||||||
.with_label_values(&[&request_method, request_path])
|
.with_label_values(&[&request_method, metric_path])
|
||||||
.start_timer(),
|
.start_timer(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user