Skip to content

Commit 1efee73

Browse files
authored
Add memory info to SystemInformation log (open-telemetry#1666)
1 parent 61b11bb commit 1efee73

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

rust/otap-dataflow/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ serde_json.workspace = true
3939
clap.workspace = true
4040
mimalloc = { workspace = true, optional = true }
4141
rustls = { workspace = true, optional = true }
42+
sysinfo.workspace = true
4243

4344
[target.'cfg(not(windows))'.dependencies]
4445
tikv-jemallocator = { workspace = true, optional = true }
@@ -134,6 +135,7 @@ slotmap = "1.0.7"
134135
smallvec = { version = "1.15" , features = ["union"] }
135136
socket2 = { version = "0.6.1", features = ["all"] }
136137
syn = { version = "2.0", features = ["full", "extra-traits"] }
138+
sysinfo = "0.37"
137139
tempfile = "3"
138140
thiserror = "2.0.17"
139141
tracing = { version = ">=0.1.40", default-features = false }

rust/otap-dataflow/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use otap_df_config::{PipelineGroupId, PipelineId};
1010
use otap_df_controller::Controller;
1111
use otap_df_otap::OTAP_PIPELINE_FACTORY;
1212
use std::path::PathBuf;
13+
use sysinfo::System;
1314

1415
#[cfg(all(
1516
not(windows),
@@ -196,6 +197,11 @@ fn system_info() -> String {
196197
"system"
197198
};
198199

200+
let mut sys = System::new_all();
201+
sys.refresh_memory();
202+
let total_memory_gb = sys.total_memory() as f64 / 1_073_741_824.0;
203+
let available_memory_gb = sys.available_memory() as f64 / 1_073_741_824.0;
204+
199205
let debug_warning = if cfg!(debug_assertions) {
200206
"\n\n⚠️ WARNING: This binary was compiled in debug mode.
201207
Debug builds are NOT recommended for production, benchmarks, or performance testing.
@@ -231,6 +237,7 @@ fn system_info() -> String {
231237
format!(
232238
"System Information:
233239
Available CPU cores: {}
240+
Available memory: {:.2} GB / {:.2} GB
234241
Build mode: {}
235242
Memory allocator: {}
236243
@@ -241,6 +248,8 @@ Available Plugin URNs:
241248
242249
Configuration files can be found in the configs/ directory.{}",
243250
available_cores,
251+
available_memory_gb,
252+
total_memory_gb,
244253
build_mode,
245254
memory_allocator,
246255
receivers_sorted.join(", "),

0 commit comments

Comments
 (0)