Skip to content

Commit

Permalink
feat: Add partition number into app dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
zuston committed Dec 5, 2024
1 parent 7be3c67 commit fe4d2c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,18 @@ impl App {
}
}

pub fn huge_partition_number(&self) -> u64 {
self.huge_partition_number.load(SeqCst)
}

pub fn partition_number(&self) -> usize {
let mut cnt = 0usize;
for entry in &self.partitions {
cnt += entry.value().len();
}
cnt
}

fn get_latest_heartbeat_time(&self) -> u64 {
self.latest_heartbeat_time.load(SeqCst)
}
Expand Down
7 changes: 5 additions & 2 deletions src/http/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fn table() -> Html<String> {
<th>registry date</th>
<th>duration (minutes)</th>
<th>resident data (gb)</th>
<th>partition number/huge partition</th>
</tr>
"#
.to_string();
Expand All @@ -71,11 +72,13 @@ fn table() -> Html<String> {
.to_string();

html_content.push_str(&format!(
"<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td></tr>",
"<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td><td>{}/{}</td></tr>",
app_id,
date,
duration_min,
bytes_to_gb(resident_bytes)
bytes_to_gb(resident_bytes),
app.partition_number(),
app.huge_partition_number(),
));
}

Expand Down

0 comments on commit fe4d2c5

Please sign in to comment.