pub struct FailStats {
pub count: i64,
pub size: i64,
pub last_minute: FailedMetric,
pub last_hour: FailedMetric,
/* private fields */
}Fields§
§count: i64§size: i64§last_minute: FailedMetricRolling-window snapshots refreshed at collection time
(Self::refresh_windows). The raw samples (recent) are process
local (serde-skipped), so these fields are what survives the peer-RPC
wire and Self::merge-based cluster aggregation.
last_hour: FailedMetricImplementations§
Source§impl FailStats
impl FailStats
pub fn new() -> Self
pub fn add_size<E>(&mut self, size: i64, _err: Option<&E>)
Sourcepub fn refresh_windows(&mut self)
pub fn refresh_windows(&mut self)
Recompute the serializable rolling-window snapshots from the local
samples. Called at the collection point (per-node stats snapshot),
never on the failure hot path — the two deque scans are O(window) and
add_size runs under the bucket-stats write lock. Only meaningful on
the live per-node struct: a deserialized or merged struct has no
samples, and refreshing it would wipe the aggregated windows.
pub fn recent_since(&self, window: Duration) -> FailedMetric
Sourcepub fn recent_windows(
&self,
short: Duration,
long: Duration,
) -> (FailedMetric, FailedMetric)
pub fn recent_windows( &self, short: Duration, long: Duration, ) -> (FailedMetric, FailedMetric)
Both rolling windows from one walk of the samples. short must be the
narrower window; the walk stops at long. Callers that need both (the
per-node site snapshot) would otherwise scan the deque twice while
holding the bucket-stats read lock, and the deque is only bounded by
the one-hour window - an unreachable target under load fills it.