XComp commented on a change in pull request #13640:
URL: https://github.com/apache/flink/pull/13640#discussion_r505472511



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/util/MetricUtils.java
##########
@@ -214,6 +219,29 @@ static void instantiateNonHeapMemoryMetrics(final 
MetricGroup metricGroup) {
                instantiateMemoryUsageMetrics(metricGroup, () -> 
ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage());
        }
 
+       @VisibleForTesting
+       static void instantiateMetaspaceMemoryMetrics(final MetricGroup 
parentMetricGroup) {
+               final List<MemoryPoolMXBean> memoryPoolMXBeans = 
ManagementFactory.getMemoryPoolMXBeans()
+                       .stream()
+                       .filter(bean -> "Metaspace".equals(bean.getName()))
+                       .collect(Collectors.toList());
+
+               if (memoryPoolMXBeans.isEmpty()) {
+                       LOG.warn("No memory pool named 'Metaspace' is present. 
The '{}' metric group is not going to be instantiated.", 
METRIC_GROUP_METASPACE_NAME);

Review comment:
       Thanks for clarification. Makes sense!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to