diff --git a/src/services/system/collector.rs b/src/services/system/collector.rs index 2f436b1..399c835 100644 --- a/src/services/system/collector.rs +++ b/src/services/system/collector.rs @@ -217,25 +217,25 @@ pub(super) fn collect( ) .expect("assert: system boot time timestamp should be valid"); let basic = [ - ("boot_time".to_string(), Datavalue::Datetime(boot_time)), - ( - "memory_available".to_string(), - Datavalue::Size(sys.available_memory()), - ), ( MEMORY_USE.to_string(), // SAFE for percentage calculation to cast from u64 to f64 Datavalue::HeatmapPercent(100.0 * sys.used_memory() as f64 / total_memory as f64), ), - ( - "swap_available".to_string(), - Datavalue::Size(sys.free_swap()), - ), ( SWAP_USE.to_string(), // SAFE for percentage calculation to cast from u64 to f64 Datavalue::HeatmapPercent(100.0 * sys.used_swap() as f64 / sys.total_swap() as f64), ), + ("boot_time".to_string(), Datavalue::Datetime(boot_time)), + ( + "memory_available".to_string(), + Datavalue::Size(sys.available_memory()), + ), + ( + "swap_available".to_string(), + Datavalue::Size(sys.free_swap()), + ), ( "num_of_processes".to_string(), Datavalue::Integer( @@ -252,7 +252,7 @@ pub(super) fn collect( ) }); - let basic_values: Vec<(String, Datavalue)> = basic.into_iter().chain(cpus).collect(); + let basic_values: Vec<(String, Datavalue)> = cpus.into_iter().chain(basic).collect(); // 1 for basic, 5 for top_ stats, 1 for network let mut datarows = Vec::with_capacity(1 + mounts.len() + 5 + names.len() + 1);