You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jg...@apache.org on 2022/03/01 19:17:44 UTC
[nifi] branch main updated: NIFI-9400: Ensure that we always use the CollectionUsage metrics in the mbeans instead of the Usage metrics.
This is an automated email from the ASF dual-hosted git repository.
jgresock pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 0d0912d NIFI-9400: Ensure that we always use the CollectionUsage metrics in the mbeans instead of the Usage metrics.
0d0912d is described below
commit 0d0912d34b7d2fb9415ad6ffb782edd32b57eb22
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Thu Feb 24 12:03:11 2022 -0500
NIFI-9400: Ensure that we always use the CollectionUsage metrics in the mbeans instead of the Usage metrics.
Signed-off-by: Joe Gresock <jg...@gmail.com>
This closes #5798.
---
.../main/java/org/apache/nifi/controller/MonitorMemory.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java
index 6bfd8e6..7c3ef52 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java
@@ -98,7 +98,7 @@ public class MonitorMemory extends AbstractReportingTask {
// Only allow memory pool beans that support usage thresholds, otherwise we wouldn't report anything anyway
memPoolAllowableValues = ManagementFactory.getMemoryPoolMXBeans()
.stream()
- .filter(MemoryPoolMXBean::isUsageThresholdSupported)
+ .filter(MemoryPoolMXBean::isCollectionUsageThresholdSupported)
.map(MemoryPoolMXBean::getName)
.map(AllowableValue::new)
.toArray(AllowableValue[]::new);
@@ -188,10 +188,11 @@ public class MonitorMemory extends AbstractReportingTask {
} else {
final String percentage = thresholdValue.substring(0, thresholdValue.length() - 1);
final double pct = Double.parseDouble(percentage) / 100D;
- calculatedThreshold = (long) (monitoredBean.getUsage().getMax() * pct);
+ calculatedThreshold = (long) (monitoredBean.getCollectionUsage().getMax() * pct);
}
- if (monitoredBean.isUsageThresholdSupported()) {
- monitoredBean.setUsageThreshold(calculatedThreshold);
+
+ if (monitoredBean.isCollectionUsageThresholdSupported()) {
+ monitoredBean.setCollectionUsageThreshold(calculatedThreshold);
}
}
}
@@ -209,7 +210,7 @@ public class MonitorMemory extends AbstractReportingTask {
return;
}
- final MemoryUsage usage = bean.getUsage();
+ final MemoryUsage usage = bean.getCollectionUsage();
if (usage == null) {
getLogger().warn("{} could not determine memory usage for pool with name {}", new Object[] {this,
context.getProperty(MEMORY_POOL_PROPERTY)});
@@ -217,7 +218,7 @@ public class MonitorMemory extends AbstractReportingTask {
}
final double percentageUsed = (double) usage.getUsed() / (double) usage.getMax() * 100D;
- if (bean.isUsageThresholdSupported() && bean.isUsageThresholdExceeded()) {
+ if (bean.isCollectionUsageThresholdSupported() && bean.isCollectionUsageThresholdExceeded()) {
if (System.currentTimeMillis() < reportingIntervalMillis + lastReportTime && lastReportTime > 0L) {
return;
}