add reminder_stats field to stats Snapshot

Add Optional<ReminderStats> field to the per-agent stats page response,
placeholder for future ReminderRollup RPC integration to fetch reminder
activity metrics from the broker.
This commit is contained in:
iris 2026-05-20 13:22:48 +02:00 committed by Mara
parent 8fe0725e1d
commit f2015954d9

View file

@ -14,6 +14,8 @@ use anyhow::{Context, Result};
use rusqlite::{Connection, OpenFlags};
use serde::Serialize;
use hive_sh4re::ReminderStats;
/// Window param accepted by `/api/stats?window=`. Each maps to a
/// total span + the bucket width used to roll up trend series.
#[derive(Debug, Clone, Copy)]
@ -81,6 +83,11 @@ pub struct Snapshot {
/// as the per-bucket fields but aggregated over the whole window
/// for the headline summary chips.
pub duration_summary: DurationSummary,
/// Reminder activity stats: counts of scheduled, delivered, and
/// pending reminders over the window (fetched from the broker RPC).
/// None if the RPC call failed or hasn't been integrated yet.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reminder_stats: Option<ReminderStats>,
}
#[derive(Debug, Serialize)]
@ -152,6 +159,7 @@ fn empty_snapshot(window: Window) -> Snapshot {
result_mix: Vec::new(),
models: Vec::new(),
duration_summary: DurationSummary::default(),
reminder_stats: None,
}
}
@ -250,6 +258,7 @@ fn snapshot(path: &Path, window: Window) -> Result<Snapshot> {
result_mix: top_n(result_totals, 20),
models,
duration_summary,
reminder_stats: None, // TODO: fetch via ReminderRollup RPC
})
}