From 985ac78939f9aa5244ad4181a4506d765a6262e2 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Mon, 2 Sep 2024 19:53:03 +0200 Subject: [PATCH 1/2] fix: simplify jemalloc metrics --- crates/alloc/src/stats.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/alloc/src/stats.rs b/crates/alloc/src/stats.rs index 4710c68..236e0a4 100644 --- a/crates/alloc/src/stats.rs +++ b/crates/alloc/src/stats.rs @@ -137,6 +137,11 @@ pub fn update_jemalloc_metrics() -> Result<(), Error> { // Cumulative number of allocation requests satisfied by bin regions of the // corresponding size class. gauge("jemalloc_memory_bin_nrequests", bin_stats.nrequests); + + gauge( + "jemalloc_memory_bin_nactive", + bin_stats.nmalloc - bin_stats.ndalloc, + ); } Ok(()) From eb5a39791ca88d372ef3068c6709aa261bb7d6cb Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Mon, 2 Sep 2024 20:13:45 +0200 Subject: [PATCH 2/2] fix: update metrics --- crates/alloc/src/stats.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/alloc/src/stats.rs b/crates/alloc/src/stats.rs index 236e0a4..a502e2d 100644 --- a/crates/alloc/src/stats.rs +++ b/crates/alloc/src/stats.rs @@ -138,10 +138,10 @@ pub fn update_jemalloc_metrics() -> Result<(), Error> { // corresponding size class. gauge("jemalloc_memory_bin_nrequests", bin_stats.nrequests); - gauge( - "jemalloc_memory_bin_nactive", - bin_stats.nmalloc - bin_stats.ndalloc, - ); + let active = bin_stats.nmalloc - bin_stats.ndalloc; + + gauge("jemalloc_memory_bin_nactive", active); + gauge("jemalloc_memory_bin_nactive_size", active * bin_const.size); } Ok(())