Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions common/health_metrics/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub static PROCESS_SHR_MEM: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
"Shared memory used by the current process",
)
});
pub static PROCESS_SECONDS: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
try_create_int_gauge(
pub static PROCESS_SECONDS: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
try_create_int_counter(
"process_cpu_seconds_total",
"Total cpu time taken by the current process",
)
Expand Down Expand Up @@ -135,8 +135,13 @@ pub fn scrape_process_health_metrics() {
set_gauge(&PROCESS_RES_MEM, health.pid_mem_resident_set_size as i64);
set_gauge(&PROCESS_VIRT_MEM, health.pid_mem_virtual_memory_size as i64);
set_gauge(&PROCESS_SHR_MEM, health.pid_mem_shared_memory_size as i64);
set_gauge(&PROCESS_SECONDS, health.pid_process_seconds_total as i64);
}

if let Ok(counter) = &*PROCESS_SECONDS {
let new_val = health.pid_process_seconds_total as u64;
counter.reset();
counter.inc_by(new_val);
}
}
}

pub fn scrape_system_health_metrics() {
Expand Down