We are using an old version of Payara, and exporting JVM metrics with the Prometheus JVM GC Exporter and Memory exporters.
In these exporters, we don't have access to the number of Java HeapSpace exceptions, which is an indicator of a inadequate value of the XMX.
I have a dashboard where I survey the memory status of our Java apps, and here is a typical example of a "memory starved" app:
I could use the GC average duration, but I'd rather have a "hard fact" counter of the number of Java Heapspace exceptions, which is the real indicator of a lack of memory. Since we are operating in a Java App server, we don't have a main() to intercept all Java HeapSpace exceptions (and we won't be able to be sure that it wasn't intercepted below so the counter might be faulty anyway).
Do you guys have had the same issues, and found a way to measure this problem? I explored the JMX tree but didn't find conclusive metrics.