jfrazee commented on a change in pull request #4790:
URL: https://github.com/apache/nifi/pull/4790#discussion_r570469548



##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java
##########
@@ -200,7 +203,7 @@ public void onTrigger(final ReportingContext context) {
         }
 
         final double percentageUsed = (double) usage.getUsed() / (double) 
usage.getMax() * 100D;
-        if (bean.isUsageThresholdExceeded()) {
+        if (bean.isUsageThresholdSupported() && 
bean.isUsageThresholdExceeded()) {

Review comment:
       Unless I'm reading this wrong, nothing will ever be reported for 
MemoryPoolMXBeans where `isUsageThresholdSupported()` is false. If that's right 
then would it make sense to also filter those out when creating the list of 
`memPoolAllowableValues` above in 
https://github.com/apache/nifi/pull/4790/files#diff-e76e0c0d02ffb91e8fceba4569e2ea59da98576b2e0c3894249ce2955c308fc9R95-R99
 ?

##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java
##########
@@ -200,7 +203,7 @@ public void onTrigger(final ReportingContext context) {
         }
 
         final double percentageUsed = (double) usage.getUsed() / (double) 
usage.getMax() * 100D;
-        if (bean.isUsageThresholdExceeded()) {
+        if (bean.isUsageThresholdSupported() && 
bean.isUsageThresholdExceeded()) {

Review comment:
       Unless I'm reading this wrong, nothing will ever be reported for 
MemoryPoolMXBeans where `isUsageThresholdSupported()` is false. If that's right 
then would it make sense to also filter those out when creating the list of 
`memPoolAllowableValues` above in this block:
   ```java
   List<MemoryPoolMXBean> memoryPoolBeans = 
ManagementFactory.getMemoryPoolMXBeans();
   memPoolAllowableValues = new AllowableValue[memoryPoolBeans.size()];
   for (int i = 0; i < memPoolAllowableValues.length; i++) {
       memPoolAllowableValues[i] = new 
AllowableValue(memoryPoolBeans.get(i).getName());
   }
   ```




----------------------------------------------------------------
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:
[email protected]


Reply via email to