From fc79053bb9ad922c8b796471aa887bd314df31df Mon Sep 17 00:00:00 2001 From: Eshan Chatterjee Date: Wed, 20 Mar 2024 11:44:46 +0530 Subject: [PATCH] fix: bug in response of stats api --- server/src/handlers/http/modal/query_server.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/handlers/http/modal/query_server.rs b/server/src/handlers/http/modal/query_server.rs index 615a2a9d9..aef8938cc 100644 --- a/server/src/handlers/http/modal/query_server.rs +++ b/server/src/handlers/http/modal/query_server.rs @@ -530,12 +530,17 @@ impl QueryServer { } pub fn merge_quried_stats(stats: Vec) -> QueriedStats { + // get the actual creation time let min_creation_time = stats .iter() .map(|x| x.creation_time.parse::>().unwrap()) .min() .unwrap_or_default(); + + // get the stream name let stream_name = stats[0].stream.clone(); + + // get the first event at let min_first_event_at = stats .iter() .map(|x| match x.first_event_at.as_ref() { @@ -554,7 +559,7 @@ impl QueryServer { .fold(IngestionStats::default(), |acc, x| IngestionStats { count: acc.count + x.count, size: format!( - "{}", + "{} Bytes", acc.size.split(' ').collect_vec()[0] .parse::() .unwrap_or_default() @@ -571,7 +576,7 @@ impl QueryServer { .map(|x| &x.storage) .fold(StorageStats::default(), |acc, x| StorageStats { size: format!( - "{}", + "{} Bytes", acc.size.split(' ').collect_vec()[0] .parse::() .unwrap_or_default()