diff options
Diffstat (limited to 'src/api/stats.rs')
| -rw-r--r-- | src/api/stats.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/api/stats.rs b/src/api/stats.rs index 838cc0f..6c5e172 100644 --- a/src/api/stats.rs +++ b/src/api/stats.rs @@ -35,6 +35,18 @@ pub(crate) struct StatsResponse { /// The peers listed in /peers together (a forgotten peer's are gone). incidents: Incidents, propagation: PropagationStats, + disk: DiskStats, +} + +/// Files this node reads and writes for itself (the state file, a backup to recover +/// from), since it started. +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +struct DiskStats { + reads: u64, + read_bytes: u64, + writes: u64, + written_bytes: u64, } /// How long changes written elsewhere took from their commit there until applied here, @@ -195,5 +207,11 @@ async fn collect(state: &AppState) -> StatsResponse { .map(|(le_ms, count)| PropagationBucket { le_ms, count }) .collect(), }, + disk: DiskStats { + reads: node.disk.reads, + read_bytes: node.disk.read_bytes, + writes: node.disk.writes, + written_bytes: node.disk.written_bytes, + }, } } |
