diff --git a/changelog.d/add_virtual_memory_process_metric.feature.md b/changelog.d/add_virtual_memory_process_metric.feature.md new file mode 100644 index 0000000000000..422232018e700 --- /dev/null +++ b/changelog.d/add_virtual_memory_process_metric.feature.md @@ -0,0 +1,3 @@ +Add virtual memory metric to the process host metrics collector. + +authors: nionata diff --git a/src/sources/host_metrics/process.rs b/src/sources/host_metrics/process.rs index 48c5392d553cf..17e7dda9e5985 100644 --- a/src/sources/host_metrics/process.rs +++ b/src/sources/host_metrics/process.rs @@ -18,6 +18,7 @@ pub struct ProcessConfig { const RUNTIME: &str = "process_runtime"; const CPU_USAGE: &str = "process_cpu_usage"; const MEMORY_USAGE: &str = "process_memory_usage"; +const MEMORY_VIRTUAL_USAGE: &str = "process_memory_virtual_usage"; impl HostMetrics { pub async fn process_metrics(&self, output: &mut super::MetricsBuffer) { @@ -46,6 +47,11 @@ impl HostMetrics { }; output.gauge(CPU_USAGE, process.cpu_usage().into(), tags()); output.gauge(MEMORY_USAGE, process.memory() as f64, tags()); + output.gauge( + MEMORY_VIRTUAL_USAGE, + process.virtual_memory() as f64, + tags(), + ); output.counter(RUNTIME, process.run_time() as f64, tags()); } } diff --git a/website/cue/reference/components/sources/host_metrics.cue b/website/cue/reference/components/sources/host_metrics.cue index d8762352f9a2d..e2b966eabb2ae 100644 --- a/website/cue/reference/components/sources/host_metrics.cue +++ b/website/cue/reference/components/sources/host_metrics.cue @@ -112,6 +112,7 @@ components: sources: host_metrics: { process_runtime: _host & _process_counter & {description: "The process uptime."} process_cpu_usage: _host & _process_gauge & {description: "The process CPU usage."} process_memory_usage: _host & _process_gauge & {description: "The process memory usage."} + process_memory_virtual_usage: _host & _process_gauge & {description: "The process virtual memory usage."} // Host cgroups cgroup_cpu_usage_seconds_total: _host & _cgroup_cpu & {description: "The total amount CPU time used by this cgroup and its descendants, in seconds."}