From b4b686d253bdfc6c2926ef9b007295bfafe3ebf5 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 27 Jun 2023 15:12:46 +0200 Subject: [PATCH] Merge all analytics events pertaining to updating the experimental features --- meilisearch/src/routes/features.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/meilisearch/src/routes/features.rs b/meilisearch/src/routes/features.rs index 08a0f5ba1..1b1c2c67a 100644 --- a/meilisearch/src/routes/features.rs +++ b/meilisearch/src/routes/features.rs @@ -54,6 +54,7 @@ async fn patch_features( Data, >, new_features: AwebJson, + req: HttpRequest, analytics: Data, ) -> Result { let features = index_scheduler.features()?; @@ -65,7 +66,7 @@ async fn patch_features( vector_store: new_features.0.vector_store.unwrap_or(old_features.vector_store), }; - analytics.publish("Experimental features PATCH".to_string(), json!(new_features), None); + analytics.publish("Experimental features Updated".to_string(), json!(new_features), Some(&req)); index_scheduler.put_runtime_features(new_features)?; Ok(HttpResponse::Ok().json(new_features)) } @@ -77,13 +78,14 @@ async fn post_features( >, new_features: AwebJson, analytics: Data, + req: HttpRequest, ) -> Result { let new_features = meilisearch_types::features::RuntimeTogglableFeatures { score_details: new_features.0.score_details.unwrap_or(false), vector_store: new_features.0.vector_store.unwrap_or(false), }; - analytics.publish("Experimental features POST".to_string(), json!(new_features), None); + analytics.publish("Experimental features Updated".to_string(), json!(new_features), Some(&req)); index_scheduler.put_runtime_features(new_features)?; Ok(HttpResponse::Ok().json(new_features)) } @@ -94,9 +96,14 @@ async fn delete_features( Data, >, analytics: Data, + req: HttpRequest, ) -> Result { let deleted_features = Default::default(); - analytics.publish("Experimental features DELETE".to_string(), json!(null), None); + analytics.publish( + "Experimental features Updated".to_string(), + json!(deleted_features), + Some(&req), + ); index_scheduler.put_runtime_features(deleted_features)?; Ok(HttpResponse::Ok().json(deleted_features)) }