mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
Don't unwrap in case of error/missing last_update field
This commit is contained in:
parent
71500a4e15
commit
5387cf1718
@ -50,14 +50,10 @@ lazy_static! {
|
|||||||
&["kind", "value"]
|
&["kind", "value"]
|
||||||
)
|
)
|
||||||
.expect("Can't create a metric");
|
.expect("Can't create a metric");
|
||||||
pub static ref MEILISEARCH_LAST_UPDATE: IntGauge = register_int_gauge!(opts!(
|
pub static ref MEILISEARCH_LAST_UPDATE: IntGauge =
|
||||||
"meilisearch_last_update",
|
register_int_gauge!(opts!("meilisearch_last_update", "Meilisearch Last Update"))
|
||||||
"Meilisearch Last Update"
|
.expect("Can't create a metric");
|
||||||
))
|
pub static ref MEILISEARCH_IS_INDEXING: IntGauge =
|
||||||
.expect("Can't create a metric");
|
register_int_gauge!(opts!("meilisearch_is_indexing", "Meilisearch Is Indexing"))
|
||||||
pub static ref MEILISEARCH_IS_INDEXING: IntGauge = register_int_gauge!(opts!(
|
.expect("Can't create a metric");
|
||||||
"meilisearch_is_indexing",
|
|
||||||
"Meilisearch Is Indexing"
|
|
||||||
))
|
|
||||||
.expect("Can't create a metric");
|
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,10 @@ pub async fn get_metrics(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::metrics::MEILISEARCH_LAST_UPDATE.set(response.last_update.unwrap().unix_timestamp());
|
if let Some(last_update) = response.last_update {
|
||||||
crate::metrics::MEILISEARCH_IS_INDEXING
|
crate::metrics::MEILISEARCH_LAST_UPDATE.set(last_update.unix_timestamp());
|
||||||
.set(index_scheduler.is_task_processing().unwrap() as i64);
|
}
|
||||||
|
crate::metrics::MEILISEARCH_IS_INDEXING.set(index_scheduler.is_task_processing()? as i64);
|
||||||
|
|
||||||
let encoder = TextEncoder::new();
|
let encoder = TextEncoder::new();
|
||||||
let mut buffer = vec![];
|
let mut buffer = vec![];
|
||||||
|
Loading…
Reference in New Issue
Block a user