Skip to content

Commit 6bc4793

Browse files
committed
feature: add timing headers to group size
1 parent 1d16986 commit 6bc4793

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

server/src/handlers/group_handler.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ pub async fn count_group_chunks(
507507
_user: LoggedUser,
508508
pool: web::Data<Pool>,
509509
) -> Result<HttpResponse, ServiceError> {
510+
let mut timer = Timer::new();
510511
let dataset_config =
511512
DatasetConfiguration::from_json(dataset_org_plan_sub.dataset.server_configuration.clone());
512513

@@ -530,16 +531,23 @@ pub async fn count_group_chunks(
530531
));
531532
};
532533

534+
timer.add("fetch group id");
535+
533536
// check if group exists
534537
get_group_by_id_query(group_id, dataset_org_plan_sub.dataset.id, pool.clone()).await?;
538+
timer.add("check postgres group exists");
535539

536540
let group_size =
537541
get_group_size_query(group_id, dataset_org_plan_sub.dataset.id, dataset_config).await?;
538542

539-
Ok(HttpResponse::Ok().json(GetChunkGroupCountResponse {
540-
group_id,
541-
count: group_size,
542-
}))
543+
timer.add("Check qdrant for group size");
544+
545+
Ok(HttpResponse::Ok()
546+
.insert_header((Timer::header_key(), timer.header_value()))
547+
.json(GetChunkGroupCountResponse {
548+
group_id,
549+
count: group_size,
550+
}))
543551
}
544552

545553
#[derive(Deserialize, Serialize, Debug, ToSchema)]

0 commit comments

Comments
 (0)