Skip to main content

Crate monitrs_core

Crate monitrs_core 

Source
Expand description

Platform-neutral core of monitrs: the data model, the rate engine, the bounded history ring, process list logic, and the diagnostic engine.

§Dependency direction

This crate depends on no terminal library and no OS collector (§10.1). It cannot know how /proc is parsed, and it cannot know how a process row is coloured. Everything here is testable from fixtures with no live system.

§Invariants worth stating once

  • Unavailable is not zero. Any metric an OS may withhold is wrapped in model::MetricState, and there is no API that turns an unavailable metric into a number (§4, §26).
  • Stale is not current. A retained value can only be read together with its age (§26).
  • The first sample of delta-based data is warming up, not zero (§8.2).
  • A PID is not an identity. model::ProcessIdentity pairs the PID with a start key so PID reuse is detectable (§26).
  • Monotonic time for rates and ordering, wall-clock for display only (§8.1).
  • Raw counters and timestamps are integral; only calculated percentages and rates use floating point, and both validate at construction (§10.4).

Re-exports§

pub use model::MetricState;
pub use model::ProcessIdentity;
pub use model::SystemSnapshot;
pub use model::UnavailableReason;

Modules§

diagnostics
Deterministic rules over collected evidence: the Pressure Radar (§2.3) and the diagnostic findings of §11.
history
The bounded in-memory history behind Time Lens (§2.1) and spike attribution (§2.2).
model
The platform-neutral data model.
process
Process list logic: ordering, filtering, and tree construction.
rates
The counter and rate engine: cumulative OS counters turned into validated rates and percentages.
units
Validated scalar types and the formatters that render them.