log the documetns updated route

This commit is contained in:
Tamo 2021-10-12 15:31:59 +02:00 committed by marin postma
parent 1ed05c6c07
commit bda7472880
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9
1 changed files with 16 additions and 3 deletions

View File

@ -167,12 +167,25 @@ pub async fn update_documents(
params: web::Query<UpdateDocumentsQuery>, params: web::Query<UpdateDocumentsQuery>,
body: Payload, body: Payload,
req: HttpRequest, req: HttpRequest,
analytics: web::Data<&'static dyn Analytics>,
) -> Result<HttpResponse, ResponseError> { ) -> Result<HttpResponse, ResponseError> {
debug!("called with params: {:?}", params); debug!("called with params: {:?}", params);
let content_type = req
.headers()
.get("Content-type")
.map(|s| s.to_str().unwrap_or("unkown"));
analytics.publish(
"Documents Updated".to_string(),
json!({
"payload_type": content_type,
"with_primary_key": params.primary_key,
"index_creation": meilisearch.get_index(path.index_uid.clone()).await.is_ok(),
}),
);
document_addition( document_addition(
req.headers() content_type,
.get("Content-type")
.map(|s| s.to_str().unwrap_or("unkown")),
meilisearch, meilisearch,
path.into_inner().index_uid, path.into_inner().index_uid,
params.into_inner().primary_key, params.into_inner().primary_key,