mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-29 16:45:30 +08:00
feat: add status code label to prometheus http request counter
This commit is contained in:
parent
ae3c31a82c
commit
5833070358
@ -19,7 +19,7 @@ lazy_static! {
|
|||||||
pub static ref MEILISEARCH_HTTP_RESPONSE_TIME_CUSTOM_BUCKETS: [f64; 29] = create_buckets();
|
pub static ref MEILISEARCH_HTTP_RESPONSE_TIME_CUSTOM_BUCKETS: [f64; 29] = create_buckets();
|
||||||
pub static ref MEILISEARCH_HTTP_REQUESTS_TOTAL: IntCounterVec = register_int_counter_vec!(
|
pub static ref MEILISEARCH_HTTP_REQUESTS_TOTAL: IntCounterVec = register_int_counter_vec!(
|
||||||
opts!("meilisearch_http_requests_total", "Meilisearch HTTP requests total"),
|
opts!("meilisearch_http_requests_total", "Meilisearch HTTP requests total"),
|
||||||
&["method", "path"]
|
&["method", "path", "status"]
|
||||||
)
|
)
|
||||||
.expect("Can't create a metric");
|
.expect("Can't create a metric");
|
||||||
pub static ref MEILISEARCH_DEGRADED_SEARCH_REQUESTS: IntGauge = register_int_gauge!(opts!(
|
pub static ref MEILISEARCH_DEGRADED_SEARCH_REQUESTS: IntGauge = register_int_gauge!(opts!(
|
||||||
|
@ -65,9 +65,6 @@ where
|
|||||||
.with_label_values(&[&request_method, request_path])
|
.with_label_values(&[&request_method, request_path])
|
||||||
.start_timer(),
|
.start_timer(),
|
||||||
);
|
);
|
||||||
crate::metrics::MEILISEARCH_HTTP_REQUESTS_TOTAL
|
|
||||||
.with_label_values(&[&request_method, request_path])
|
|
||||||
.inc();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,6 +73,14 @@ where
|
|||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let res = fut.await?;
|
let res = fut.await?;
|
||||||
|
|
||||||
|
crate::metrics::MEILISEARCH_HTTP_REQUESTS_TOTAL
|
||||||
|
.with_label_values(&[
|
||||||
|
res.request().method().as_str(),
|
||||||
|
res.request().path(),
|
||||||
|
res.status().as_str(),
|
||||||
|
])
|
||||||
|
.inc();
|
||||||
|
|
||||||
if let Some(histogram_timer) = histogram_timer {
|
if let Some(histogram_timer) = histogram_timer {
|
||||||
histogram_timer.observe_duration();
|
histogram_timer.observe_duration();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user