From 10dc72513d588320dafdb8ee452cdc9ea08bc722 Mon Sep 17 00:00:00 2001 From: Danny Thomas Date: Fri, 18 Nov 2022 16:12:01 +1100 Subject: [PATCH] Add ZGC generational memory managers (#1007) Update the HelperFunctions to include the ZGC generational memory managers and properly match Shenandoah and ZGC generational pool names. --- .../java/com/netflix/spectator/gc/HelperFunctions.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java b/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java index ed238fe54..9311038ad 100644 --- a/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java +++ b/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java @@ -43,6 +43,10 @@ private static Map knownCollectors() { m.put("ZGC", GcType.OLD); m.put("ZGC Cycles", GcType.OLD); m.put("ZGC Pauses", GcType.OLD); + m.put("ZGC Minor Cycles", GcType.YOUNG); + m.put("ZGC Minor Pauses", GcType.YOUNG); + m.put("ZGC Major Cycles", GcType.OLD); + m.put("ZGC Major Pauses", GcType.OLD); m.put("Shenandoah Cycles", GcType.OLD); m.put("Shenandoah Pauses", GcType.OLD); return Collections.unmodifiableMap(m); @@ -61,7 +65,7 @@ static boolean isOldGcType(String name) { /** Returns true if memory pool name matches an old generation pool. */ static boolean isOldGenPool(String name) { - return name.endsWith("Old Gen") + return name.contains("Old Gen") || name.endsWith("Tenured Gen") || "Shenandoah".equals(name) || "ZHeap".equals(name); @@ -69,7 +73,8 @@ static boolean isOldGenPool(String name) { /** Returns true if memory pool name matches an young generation pool. */ static boolean isYoungGenPool(String name) { - return name.endsWith("Eden Space") + return name.contains("Young Gen") + || name.endsWith("Eden Space") || "Shenandoah".equals(name) || "ZHeap".equals(name); }