Skip to content

Commit fe4d2c5

Browse files
committed
feat: Add partition number into app dashboard
1 parent 7be3c67 commit fe4d2c5

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/app.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,18 @@ impl App {
289289
}
290290
}
291291

292+
pub fn huge_partition_number(&self) -> u64 {
293+
self.huge_partition_number.load(SeqCst)
294+
}
295+
296+
pub fn partition_number(&self) -> usize {
297+
let mut cnt = 0usize;
298+
for entry in &self.partitions {
299+
cnt += entry.value().len();
300+
}
301+
cnt
302+
}
303+
292304
fn get_latest_heartbeat_time(&self) -> u64 {
293305
self.latest_heartbeat_time.load(SeqCst)
294306
}

src/http/app.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ fn table() -> Html<String> {
5050
<th>registry date</th>
5151
<th>duration (minutes)</th>
5252
<th>resident data (gb)</th>
53+
<th>partition number/huge partition</th>
5354
</tr>
5455
"#
5556
.to_string();
@@ -71,11 +72,13 @@ fn table() -> Html<String> {
7172
.to_string();
7273

7374
html_content.push_str(&format!(
74-
"<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td></tr>",
75+
"<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td><td>{}/{}</td></tr>",
7576
app_id,
7677
date,
7778
duration_min,
78-
bytes_to_gb(resident_bytes)
79+
bytes_to_gb(resident_bytes),
80+
app.partition_number(),
81+
app.huge_partition_number(),
7982
));
8083
}
8184

0 commit comments

Comments
 (0)