Skip to content

Commit b0fba06

Browse files
authored
fix: stats endpoint response (#710)
fix: bug in response of stats api
1 parent 51142cb commit b0fba06

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

server/src/handlers/http/modal/query_server.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,17 @@ impl QueryServer {
530530
}
531531

532532
pub fn merge_quried_stats(stats: Vec<QueriedStats>) -> QueriedStats {
533+
// get the actual creation time
533534
let min_creation_time = stats
534535
.iter()
535536
.map(|x| x.creation_time.parse::<DateTime<Utc>>().unwrap())
536537
.min()
537538
.unwrap_or_default();
539+
540+
// get the stream name
538541
let stream_name = stats[0].stream.clone();
542+
543+
// get the first event at
539544
let min_first_event_at = stats
540545
.iter()
541546
.map(|x| match x.first_event_at.as_ref() {
@@ -554,7 +559,7 @@ impl QueryServer {
554559
.fold(IngestionStats::default(), |acc, x| IngestionStats {
555560
count: acc.count + x.count,
556561
size: format!(
557-
"{}",
562+
"{} Bytes",
558563
acc.size.split(' ').collect_vec()[0]
559564
.parse::<u64>()
560565
.unwrap_or_default()
@@ -571,7 +576,7 @@ impl QueryServer {
571576
.map(|x| &x.storage)
572577
.fold(StorageStats::default(), |acc, x| StorageStats {
573578
size: format!(
574-
"{}",
579+
"{} Bytes",
575580
acc.size.split(' ').collect_vec()[0]
576581
.parse::<u64>()
577582
.unwrap_or_default()

0 commit comments

Comments
 (0)