mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-16 19:30:43 +00:00
Expose the number of internal chat searches on the /metrics route
This commit is contained in:
@ -15,6 +15,12 @@ lazy_static! {
|
|||||||
"Meilisearch number of degraded search requests"
|
"Meilisearch number of degraded search requests"
|
||||||
))
|
))
|
||||||
.expect("Can't create a metric");
|
.expect("Can't create a metric");
|
||||||
|
pub static ref MEILISEARCH_CHAT_INTERNAL_SEARCH_REQUESTS: IntGauge =
|
||||||
|
register_int_gauge!(opts!(
|
||||||
|
"meilisearch_chat_internal_search_requests",
|
||||||
|
"Meilisearch number of search requests performed by the chat route itself"
|
||||||
|
))
|
||||||
|
.expect("Can't create a metric");
|
||||||
pub static ref MEILISEARCH_DB_SIZE_BYTES: IntGauge =
|
pub static ref MEILISEARCH_DB_SIZE_BYTES: IntGauge =
|
||||||
register_int_gauge!(opts!("meilisearch_db_size_bytes", "Meilisearch DB Size In Bytes"))
|
register_int_gauge!(opts!("meilisearch_db_size_bytes", "Meilisearch DB Size In Bytes"))
|
||||||
.expect("Can't create a metric");
|
.expect("Can't create a metric");
|
||||||
|
@ -48,7 +48,9 @@ use crate::analytics::Analytics;
|
|||||||
use crate::error::MeilisearchHttpError;
|
use crate::error::MeilisearchHttpError;
|
||||||
use crate::extractors::authentication::policies::ActionPolicy;
|
use crate::extractors::authentication::policies::ActionPolicy;
|
||||||
use crate::extractors::authentication::{extract_token_from_request, GuardedData, Policy as _};
|
use crate::extractors::authentication::{extract_token_from_request, GuardedData, Policy as _};
|
||||||
use crate::metrics::MEILISEARCH_DEGRADED_SEARCH_REQUESTS;
|
use crate::metrics::{
|
||||||
|
MEILISEARCH_CHAT_INTERNAL_SEARCH_REQUESTS, MEILISEARCH_DEGRADED_SEARCH_REQUESTS,
|
||||||
|
};
|
||||||
use crate::routes::chats::utils::SseEventSender;
|
use crate::routes::chats::utils::SseEventSender;
|
||||||
use crate::routes::indexes::search::search_kind;
|
use crate::routes::indexes::search::search_kind;
|
||||||
use crate::search::{add_search_rules, prepare_search, search_from_kind, SearchQuery};
|
use crate::search::{add_search_rules, prepare_search, search_from_kind, SearchQuery};
|
||||||
@ -286,7 +288,7 @@ async fn process_search_request(
|
|||||||
let output = output?;
|
let output = output?;
|
||||||
let mut documents = Vec::new();
|
let mut documents = Vec::new();
|
||||||
if let Ok((ref rtxn, ref search_result)) = output {
|
if let Ok((ref rtxn, ref search_result)) = output {
|
||||||
// aggregate.succeed(search_result);
|
MEILISEARCH_CHAT_INTERNAL_SEARCH_REQUESTS.inc();
|
||||||
if search_result.degraded {
|
if search_result.degraded {
|
||||||
MEILISEARCH_DEGRADED_SEARCH_REQUESTS.inc();
|
MEILISEARCH_DEGRADED_SEARCH_REQUESTS.inc();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user