add a view for the task queue in the metrics

This commit is contained in:
Tamo 2023-05-25 12:58:13 +02:00
parent 1b601f70c6
commit c433bdd1cd
4 changed files with 1352 additions and 962 deletions

View file

@ -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");