mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-28 01:01:00 +00:00
Expose lastUpdate and isIndexing in /stats endpoint
This commit is contained in:
@ -50,4 +50,14 @@ lazy_static! {
|
||||
&["kind", "value"]
|
||||
)
|
||||
.expect("Can't create a metric");
|
||||
pub static ref MEILISEARCH_LAST_UPDATE: IntGauge = register_int_gauge!(opts!(
|
||||
"meilisearch_last_update",
|
||||
"Meilisearch Last Update"
|
||||
))
|
||||
.expect("Can't create a metric");
|
||||
pub static ref MEILISEARCH_IS_INDEXING: IntGauge = register_int_gauge!(opts!(
|
||||
"meilisearch_is_indexing",
|
||||
"Meilisearch Is Indexing"
|
||||
))
|
||||
.expect("Can't create a metric");
|
||||
}
|
||||
|
@ -48,6 +48,9 @@ pub async fn get_metrics(
|
||||
}
|
||||
}
|
||||
|
||||
crate::metrics::MEILISEARCH_LAST_UPDATE.set(response.last_update.unwrap().unix_timestamp() as i64);
|
||||
crate::metrics::MEILISEARCH_IS_INDEXING.set(index_scheduler.is_task_processing().unwrap() as i64);
|
||||
|
||||
let encoder = TextEncoder::new();
|
||||
let mut buffer = vec![];
|
||||
encoder.encode(&prometheus::gather(), &mut buffer).expect("Failed to encode metrics");
|
||||
|
Reference in New Issue
Block a user