Skip to main content

parse_one_metric

Function parse_one_metric 

Source
pub fn parse_one_metric(
    stats: &mut SystemdUnitStats,
    metric: &ListOutput,
    config: &UnitsConfig,
    services: &HashSet<String>,
    has_load_state_totals: bool,
) -> Result<()>
Expand description

Parse state of a unit into our unit_states hash

services is the [services] config list: per-service stats are tracked only for those units, mirroring the D-Bus path.

has_load_state_totals says whether this run’s metrics include the exact UnitsByLoadStateTotal family. When they do, the per-unit UnitLoadState metrics must not also be counted into the load-state totals, or every unit would be counted twice; the metric stream has no guaranteed ordering, so the caller determines this up front rather than relying on which arrives first.