mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
add a view for the task queue in the metrics
This commit is contained in:
parent
1b601f70c6
commit
c433bdd1cd
4 changed files with 1352 additions and 962 deletions
|
@ -40,4 +40,7 @@ lazy_static! {
|
|||
HTTP_RESPONSE_TIME_CUSTOM_BUCKETS.to_vec()
|
||||
)
|
||||
.expect("Can't create a metric");
|
||||
pub static ref NB_TASKS: IntGaugeVec =
|
||||
register_int_gauge_vec!(opts!("nb_tasks", "Number of tasks"), &["kind", "value"])
|
||||
.expect("Can't create a metric");
|
||||
}
|
||||
|
|
|
@ -39,6 +39,12 @@ pub async fn get_metrics(
|
|||
.set(value.number_of_documents as i64);
|
||||
}
|
||||
|
||||
for (kind, value) in index_scheduler.get_stats()? {
|
||||
for (value, count) in value {
|
||||
crate::metrics::NB_TASKS.with_label_values(&[&kind, &value]).set(count as i64);
|
||||
}
|
||||
}
|
||||
|
||||
let encoder = TextEncoder::new();
|
||||
let mut buffer = vec![];
|
||||
encoder.encode(&prometheus::gather(), &mut buffer).expect("Failed to encode metrics");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue