add analytics on the stats routes

This commit is contained in:
Irevoire 2022-08-17 16:12:26 +02:00
parent 22874ce300
commit 62240b7e19
No known key found for this signature in database
GPG key ID: 7A6A970C96104F1B
2 changed files with 17 additions and 1 deletions

View file

@ -158,7 +158,14 @@ pub async fn delete_index(
pub async fn get_index_stats(
meilisearch: GuardedData<ActionPolicy<{ actions::STATS_GET }>, MeiliSearch>,
path: web::Path<String>,
req: HttpRequest,
analytics: web::Data<dyn Analytics>,
) -> Result<HttpResponse, ResponseError> {
analytics.publish(
"Stats Seen".to_string(),
json!({ "per_index_uid": true }),
Some(&req),
);
let response = meilisearch.get_index_stats(path.into_inner()).await?;
debug!("returns: {:?}", response);