diff --git a/rustfs/src/memory_observability.rs b/rustfs/src/memory_observability.rs index f0a7b5093..8a5e2aef7 100644 --- a/rustfs/src/memory_observability.rs +++ b/rustfs/src/memory_observability.rs @@ -17,6 +17,7 @@ use rustfs_io_metrics::{ record_cpu_usage, record_memory_usage, record_process_memory_split, }; use serde::Serialize; +#[cfg(any(test, not(target_os = "windows")))] use serde_json::Value; use std::collections::HashMap; #[cfg(not(target_os = "windows"))] @@ -213,6 +214,7 @@ fn read_cgroup_memory_snapshot() -> Option { read_cgroup_v2().or_else(read_cgroup_v1) } +#[cfg(any(test, not(target_os = "windows")))] fn numeric_json_value(value: &Value) -> Option { match value { Value::Number(number) => number @@ -223,6 +225,7 @@ fn numeric_json_value(value: &Value) -> Option { } } +#[cfg(any(test, not(target_os = "windows")))] fn numeric_json_field(value: &Value, field: &str) -> Option { match value { Value::Object(fields) => fields @@ -234,6 +237,7 @@ fn numeric_json_field(value: &Value, field: &str) -> Option { } } +#[cfg(any(test, not(target_os = "windows")))] fn mimalloc_stat_field(value: &Value, metric: &str, field: &str) -> Option { match value { Value::Object(fields) => { @@ -250,10 +254,12 @@ fn mimalloc_stat_field(value: &Value, metric: &str, field: &str) -> Option } } +#[cfg(any(test, not(target_os = "windows")))] fn mimalloc_stat_current(value: &Value, metric: &str) -> Option { mimalloc_stat_field(value, metric, "current") } +#[cfg(any(test, not(target_os = "windows")))] fn parse_mimalloc_stats_json(stats_json: &str) -> Option { let value = serde_json::from_str::(stats_json).ok()?; let observation = AllocatorMemoryObservation {