@@ -60,8 +60,9 @@ public class DataReaderUnifiedJvmLogging extends AbstractDataReader {
6060 // Group 6 / tail: Pause Init Mark 1.070ms
6161 // Regex: ^(?:\[(?<time>[0-9-T:.+]*)])?(?:\[(?<uptime>[^s]*)s])?\[(?<level>[^]]+)]\[(?:(?<tags>[^] ]+)[ ]*)][ ]GC\((?<gcnumber>[0-9]+)\)[ ](?<type>([-.a-zA-Z ()]+|[a-zA-Z1 ()]+))(?:(?:[ ](?<tail>[0-9]{1}.*))|$)
6262 // note for the <type> part: easiest would have been to use [^0-9]+, but the G1 events don't fit there, because of the number in their name
63+ // add sub regex "[a-zA-Z ]+\\(.+\\)" for Allocation Stall and Relocation Stall of ZGC
6364 private static final Pattern PATTERN_DECORATORS = Pattern .compile (
64- "^(?:\\ [(?<time>[0-9-T:.+]*)])?(?:\\ [(?<uptime>[^ms]*)(?<uptimeunit>m?s)])?\\ [(?<level>[^]]+)]\\ [(?:(?<tags>[^] ]+)[ ]*)][ ](GC\\ ((?<gcnumber>[0-9]+)\\ )[ ])?(?<type>(?:Phase [0-9]{1}: [a-zA-Z ]+)|[-.a-zA-Z: ()]+|[a-zA-Z1 ()]+)(?:(?:[ ](?<tail>[0-9]{1}.*))|$)"
65+ "^(?:\\ [(?<time>[0-9-T:.+]*)])?(?:\\ [(?<uptime>[^ms]*)(?<uptimeunit>m?s)])?\\ [(?<level>[^]]+)]\\ [(?:(?<tags>[^] ]+)[ ]*)][ ](GC\\ ((?<gcnumber>[0-9]+)\\ )[ ])?(?<type>(?:Phase [0-9]{1}: [a-zA-Z ]+)|[-.a-zA-Z: ()]+|[a-zA-Z1 ()]+|[a-zA-Z ]+ \\ (.+ \\ ) )(?:(?:[ ](?<tail>[0-9]{1}.*))|$)"
6566 );
6667 private static final String GROUP_DECORATORS_TIME = "time" ;
6768 private static final String GROUP_DECORATORS_UPTIME = "uptime" ;
@@ -176,7 +177,20 @@ public class DataReaderUnifiedJvmLogging extends AbstractDataReader {
176177 "Cancelling GC" ,
177178 "CDS archive(s) mapped at" , // metaspace preamble since JDK 17
178179 "Compressed class space mapped at" , // metaspace preamble since JDK 17
179- "Narrow klass base" // metaspace preamble since JDK 17
180+ "Narrow klass base" , // metaspace preamble since JDK 17
181+ " Mark Start " , // heap preamble for ZGC since JDK 11
182+ "Reserve:" , // heap preamble for ZGC since JDK 11
183+ "Free:" , // heap preamble for ZGC since JDK 11
184+ "Used:" , // heap preamble for ZGC since JDK 11
185+ "Live:" , // heap preamble for ZGC since JDK 11
186+ "Allocated:" , // heap preamble for ZGC since JDK 11
187+ "Garbage:" , // heap preamble for ZGC since JDK 11
188+ "Reclaimed:" , // heap preamble for ZGC since JDK 11
189+ "Page Cache Flushed:" , // heap preamble for ZGC since JDK 11
190+ "Min Capacity:" , // heap preamble for ZGC since JDK 11
191+ "Max Capacity:" , // heap preamble for ZGC since JDK 11
192+ "Soft Max Capacity:" , // heap preamble for ZGC since JDK 11
193+ "Uncommitted:" // heap preamble for ZGC since JDK 11
180194 );
181195 /** list of strings, that are gc log lines, but not a gc event -> should be logged only */
182196 private static final List <String > LOG_ONLY_STRINGS = Arrays .asList ("Using" ,
@@ -300,6 +314,19 @@ private AbstractGCEvent<?> handleTagGcPhasesTail(ParseContext context, AbstractG
300314
301315 private AbstractGCEvent <?> handleTagGcMetaspaceTail (ParseContext context , AbstractGCEvent <?> event , String tail ) {
302316 AbstractGCEvent <?> returnEvent = event ;
317+ // the event "Metaspace" in gc tag "[gc,metaspace]" for ZGC don't match the "PATTERN_MEMORY" rules; ignore it
318+ // ZGC:
319+ // [1.182s][info][gc,metaspace] GC(0) Metaspace: 19M used, 19M capacity, 19M committed, 20M reserved
320+ // [1.182s][info][gc,metaspace] GC(0) Metaspace: 11M used, 12M committed, 1088M reserved
321+ // G1:
322+ // [5.537s][info][gc,metaspace] GC(0) Metaspace: 118K(320K)->118K(320K) NonClass: 113K(192K)->113K(192K) Class: 4K(128K)->4K(128K)
323+
324+ if (returnEvent .getExtendedType ().getType ().equals (Type .METASPACE ) && tail != null ) {
325+ if (tail .contains ("used," ) && tail .contains ("committed," )) {
326+ return null ;
327+ }
328+ }
329+
303330 returnEvent = parseTail (context , returnEvent , tail );
304331 // the UJL "Old" event occurs often after the next STW events have taken place; ignore it for now
305332 // size after concurrent collection will be calculated by GCModel#add()
0 commit comments