From f54709a56be7501f25bdce803fa671adb1e89f2d Mon Sep 17 00:00:00 2001 From: Brent Dearth Date: Tue, 30 Jan 2024 13:53:01 -0700 Subject: [PATCH] feat(process): support malloc / oldmalloc increase bytes limit GC stat (#305) --- lib/prometheus_exporter/instrumentation/process.rb | 2 ++ lib/prometheus_exporter/server/process_collector.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/prometheus_exporter/instrumentation/process.rb b/lib/prometheus_exporter/instrumentation/process.rb index 4ec4bfd5..69624488 100644 --- a/lib/prometheus_exporter/instrumentation/process.rb +++ b/lib/prometheus_exporter/instrumentation/process.rb @@ -63,6 +63,8 @@ def collect_gc_stats(metric) metric[:major_gc_ops_total] = stat[:major_gc_count] metric[:minor_gc_ops_total] = stat[:minor_gc_count] metric[:allocated_objects_total] = stat[:total_allocated_objects] + metric[:malloc_increase_bytes_limit] = stat[:malloc_increase_bytes_limit] + metric[:oldmalloc_increase_bytes_limit] = stat[:oldmalloc_increase_bytes_limit] end def collect_v8_stats(metric) diff --git a/lib/prometheus_exporter/server/process_collector.rb b/lib/prometheus_exporter/server/process_collector.rb index 6a3a0088..baccd4d7 100644 --- a/lib/prometheus_exporter/server/process_collector.rb +++ b/lib/prometheus_exporter/server/process_collector.rb @@ -13,6 +13,8 @@ class ProcessCollector < TypeCollector v8_physical_size: "Physical size consumed by V8 heaps.", v8_heap_count: "Number of V8 contexts running.", rss: "Total RSS used by process.", + malloc_increase_bytes_limit: 'Limit before Ruby triggers a GC against current objects (bytes).', + oldmalloc_increase_bytes_limit: 'Limit before Ruby triggers a major GC against old objects (bytes).' } PROCESS_COUNTERS = {