pub struct Thresholds {Show 30 fields
pub enabled: bool,
pub cpu_watch_percent: f32,
pub cpu_critical_percent: f32,
pub memory_watch_available_percent: f32,
pub memory_critical_available_percent: f32,
pub sustained_samples: usize,
pub sustained_window: usize,
pub swap_watch_bytes_per_second: f64,
pub swap_critical_bytes_per_second: f64,
pub psi_watch_percent: f32,
pub psi_critical_percent: f32,
pub disk_busy_watch_percent: f32,
pub disk_busy_critical_percent: f32,
pub network_watch_percent: f32,
pub network_critical_percent: f32,
pub load_watch_per_cpu: f32,
pub load_critical_per_cpu: f32,
pub process_cpu_spike_percent: f32,
pub process_cpu_spike_points: f32,
pub process_rss_minimum_bytes: u64,
pub process_rss_growth_bytes_per_minute: u64,
pub zombie_watch_count: usize,
pub collector_lag_watch_intervals: f32,
pub collector_lag_critical_intervals: f32,
pub stale_watch_intervals: f32,
pub stale_critical_intervals: f32,
pub discontinuity_intervals: f32,
pub self_cpu_budget_percent: f32,
pub self_rss_budget_bytes: u64,
pub self_sample_budget_millis: u64,
}Expand description
Every threshold the diagnostic engine reads.
Deliberately Copy plain data: rules hold a copy so that evaluating a rule is
a pure function of (snapshot, history) and needs no shared configuration
handle (§11.1).
Values arriving from configuration are not trusted. Thresholds::sanitized
repairs the combinations that would otherwise make a rule silently
undecidable — a critical threshold below its watch threshold, a window
narrower than the number of samples counted inside it, a non-finite percentage.
Fields§
§enabled: bool§12’s diagnostics.enabled.
When false the engine derives nothing at all: super::RuleSet produces
no findings and every radar signal reports crate::MetricState::Unsupported.
It deliberately does not report normal, because “we did not look” and
“we looked and the system is fine” are different statements (§2.3).
cpu_watch_percent: f32Aggregate CPU busy percentage at which the CPU signal reaches watch.
cpu_critical_percent: f32Aggregate CPU busy percentage at which the CPU signal reaches critical.
memory_watch_available_percent: f32Available-memory share at or below which the memory signal reaches watch.
Expressed as available rather than used because that is the number that predicts reclaim pressure, and because §8.4 forbids treating all non-free memory as application use.
memory_critical_available_percent: f32Available-memory share at or below which the memory signal reaches
critical.
sustained_samples: usizeHow many samples inside the window must meet a condition before a sustained finding is made, and before hysteresis escalates a signal.
Also the minimum number of observations required before any sustained
claim is possible at all: with fewer than this, the signal is
crate::MetricState::WarmingUp (§11.3).
sustained_window: usizeHow many recent samples sustained_samples is counted out of.
swap_watch_bytes_per_second: f64Combined swap-in plus swap-out throughput at which swap activity is
watch, in bytes per second.
Default 1 MiB/s. Below that, paging is ordinary lazy loading and a large but idle swap file is unremarkable; §11.2 cares about activity.
swap_critical_bytes_per_second: f64Combined swap throughput at which swap activity is critical, in bytes
per second.
Default 16 MiB/s: sustained tens of mebibytes per second means the working set does not fit and every fault is paid for in latency.
psi_watch_percent: f32Linux PSI some avg10 share at which a PSI signal reaches watch.
Default 10%: a tenth of the last ten seconds with at least one task stalled is measurable rather than incidental.
psi_critical_percent: f32Linux PSI some avg10 share at which a PSI signal reaches critical.
Default 40%. Note that a busy machine legitimately shows non-zero CPU PSI, which is why this is generous rather than near zero.
disk_busy_watch_percent: f32Block-device busy percentage at which the disk signal reaches watch.
Only meaningful where the platform reports a semantically correct busy figure (§7.3); elsewhere the signal is unsupported rather than zero.
disk_busy_critical_percent: f32Block-device busy percentage at which the disk signal reaches critical.
network_watch_percent: f32Link utilization at which the network signal reaches watch.
Only computed when the link speed is known (§7.4).
network_critical_percent: f32Link utilization at which the network signal reaches critical.
load_watch_per_cpu: f32One-minute load per logical CPU at which the load signal reaches watch.
Default 1.0: a run queue as long as the CPU count means everything runnable is waiting for a turn.
load_critical_per_cpu: f32One-minute load per logical CPU at which the load signal reaches
critical. Default 2.0.
process_cpu_spike_percent: f32Core-normalized CPU percentage a process must reach before a rise in its usage is reported at all. Default 100%, i.e. a full core.
process_cpu_spike_points: f32Percentage points a process’s CPU must rise between two samples to be called a spike. Default 50 points.
process_rss_minimum_bytes: u64Resident set size a process must exceed before its growth is reported.
Default 128 MiB. Small processes double their footprint routinely and reporting them would bury the interesting cases.
process_rss_growth_bytes_per_minute: u64Resident-set growth rate that counts as rapidly increasing, in bytes per minute.
Default 64 MiB/min. §11.3 forbids concluding anything about why memory is growing from this alone, so the rule reports the observation only.
zombie_watch_count: usizeHow many zombies must be present before the finding escalates from
informational to watch.
Default 8. One zombie is a normal instant in a process’s teardown; a growing pile means a parent is not reaping (§11.2).
collector_lag_watch_intervals: f32Collector lag, in sample intervals, at which falling behind is watch.
collector_lag_critical_intervals: f32Collector lag, in sample intervals, at which falling behind is critical.
stale_watch_intervals: f32Data age, in sample intervals, at which a snapshot counts as stale.
stale_critical_intervals: f32Data age, in sample intervals, at which staleness is critical.
discontinuity_intervals: f32Interval growth, in sample intervals, that is treated as a discontinuity rather than as a measurement.
A suspended laptop produces one enormous interval. §11.3 requires the engine to reset cleanly across that rather than read the gap as an event, so anything beyond this multiple of the normal interval clears hysteresis state instead of feeding it (default 10 intervals).
self_cpu_budget_percent: f32Our own CPU budget, core-normalized (§16.1: p95 below 2%).
self_rss_budget_bytes: u64Our own resident memory budget (§16.1: below 50 MiB).
self_sample_budget_millis: u64Our own fast-tier collection budget, in milliseconds (§16.1: p95 below 200 ms at 200 processes).
Stored as milliseconds rather than a Duration so that it round-trips
through a configuration file as a plain number; Self::self_sample_budget
converts it.
Implementations§
Source§impl Thresholds
impl Thresholds
Sourcepub fn sanitized(self) -> Self
pub fn sanitized(self) -> Self
Repairs values that would make a rule undecidable.
Clamping rather than rejecting matches §8.5’s treatment of history
configuration: a mistyped number must not stop monitrs from starting, and
it must not silently disable a documented signal either. Every constructor
in this module sanitizes, so no rule has to defend itself against
sustained_window < sustained_samples or a NaN percentage.
Sourcepub const fn minimum_samples(&self) -> usize
pub const fn minimum_samples(&self) -> usize
How many observations must exist before any sustained claim is possible.
Below this the signal is crate::MetricState::WarmingUp rather than
normal: a rule that needs ten samples has no opinion after three, and
§26 forbids dressing “no opinion” up as a measurement.
Sourcepub const fn self_sample_budget(&self) -> Duration
pub const fn self_sample_budget(&self) -> Duration
The fast-tier collection budget as a duration (§16.1).
Sourcepub fn memory_watch_used_percent(&self) -> f32
pub fn memory_watch_used_percent(&self) -> f32
The used-memory share equivalent to Self::memory_watch_available_percent.
History retains the used share (§8.5), so the available-share thresholds have to be expressed in the same terms to be counted over a window.
Sourcepub fn memory_critical_used_percent(&self) -> f32
pub fn memory_critical_used_percent(&self) -> f32
The used-memory share equivalent to
Self::memory_critical_available_percent.
Sourcepub fn intervals_as_seconds(interval: Duration, multiple: f32) -> f64
pub fn intervals_as_seconds(interval: Duration, multiple: f32) -> f64
Scales a sample interval by a multiplier without risking an overflow panic.
Duration::mul_f32 panics on overflow, which §14.3 forbids anywhere near
the render path, so the arithmetic is done in seconds and compared as such.
Trait Implementations§
Source§impl Clone for Thresholds
impl Clone for Thresholds
Source§fn clone(&self) -> Thresholds
fn clone(&self) -> Thresholds
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more