diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnostics.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnostics.java index 2d77e709b9..7b50ebcd77 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnostics.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnostics.java @@ -150,11 +150,19 @@ public class SystemDiagnostics implements Cloneable { } public int getHeapUtilization() { - return DiagnosticUtils.getUtilization(usedHeap, maxHeap); + if (maxHeap == -1) { + return -1; + } else { + return DiagnosticUtils.getUtilization(usedHeap, maxHeap); + } } public int getNonHeapUtilization() { - return DiagnosticUtils.getUtilization(usedNonHeap, maxNonHeap); + if (maxNonHeap == -1) { + return -1; + } else { + return DiagnosticUtils.getUtilization(usedNonHeap, maxNonHeap); + } } public Map getGarbageCollection() { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java index f26d1b727d..a2619e6cbc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java @@ -1735,14 +1735,18 @@ public final class DtoFactory { dto.setTotalHeap(FormatUtils.formatDataSize(sysDiagnostics.getTotalHeap())); dto.setUsedHeap(FormatUtils.formatDataSize(sysDiagnostics.getUsedHeap())); dto.setFreeHeap(FormatUtils.formatDataSize(sysDiagnostics.getFreeHeap())); - dto.setHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getHeapUtilization())); + if (sysDiagnostics.getHeapUtilization() != -1) { + dto.setHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getHeapUtilization())); + } // non heap dto.setMaxNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getMaxNonHeap())); dto.setTotalNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getTotalNonHeap())); dto.setUsedNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getUsedNonHeap())); dto.setFreeNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getFreeNonHeap())); - dto.setNonHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getNonHeapUtilization())); + if (sysDiagnostics.getNonHeapUtilization() != -1) { + dto.setNonHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getNonHeapUtilization())); + } // flow file disk usage final SystemDiagnosticsDTO.StorageUsageDTO flowFileRepositoryStorageUsageDto = createStorageUsageDTO(null, sysDiagnostics.getFlowFileRepositoryStorageUsage()); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/system-diagnostics-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/system-diagnostics-dialog.jsp index d49f607356..577c1d8801 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/system-diagnostics-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/system-diagnostics-dialog.jsp @@ -29,7 +29,7 @@
-
Heap ()
+
Heap
@@ -57,7 +57,7 @@
-
Non heap ()
+
Non heap
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js index fe4ed919a3..156ad4cb68 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js @@ -1999,14 +1999,26 @@ nf.SummaryTable = (function () { $('#total-heap').text(systemDiagnostics.totalHeap); $('#used-heap').text(systemDiagnostics.usedHeap); $('#free-heap').text(systemDiagnostics.freeHeap); - $('#utilization-heap').text(systemDiagnostics.heapUtilization); + + // ensure the heap utilization could be calculated + if (nf.Common.isDefinedAndNotNull(systemDiagnostics.heapUtilization)) { + $('#utilization-heap').text('(' + systemDiagnostics.heapUtilization + ')'); + } else { + $('#utilization-heap').text(''); + } // non heap $('#max-non-heap').text(systemDiagnostics.maxNonHeap); $('#total-non-heap').text(systemDiagnostics.totalNonHeap); $('#used-non-heap').text(systemDiagnostics.usedNonHeap); $('#free-non-heap').text(systemDiagnostics.freeNonHeap); - $('#utilization-non-heap').text(systemDiagnostics.nonHeapUtilization); + + // enure the non heap utilization could be calculated + if (nf.Common.isDefinedAndNotNull(systemDiagnostics.nonHeapUtilization)) { + $('#utilization-non-heap').text('(' + systemDiagnostics.nonHeapUtilization + ')'); + } else { + $('#utilization-non-heap').text(''); + } // garbage collection var garbageCollectionContainer = $('#garbage-collection-table tbody').empty(); @@ -2014,9 +2026,15 @@ nf.SummaryTable = (function () { addGarbageCollection(garbageCollectionContainer, garbageCollection); }); - // load + // available processors $('#available-processors').text(systemDiagnostics.availableProcessors); - $('#processor-load-average').html(nf.Common.formatValue(systemDiagnostics.processorLoadAverage)); + + // load + if (nf.Common.isDefinedAndNotNull(systemDiagnostics.processorLoadAverage)) { + $('#processor-load-average').text(nf.Common.formatFloat(systemDiagnostics.processorLoadAverage)); + } else { + $('#processor-load-average').html(nf.Common.formatValue(systemDiagnostics.processorLoadAverage)); + } // database storage usage var flowFileRepositoryStorageUsageContainer = $('#flow-file-repository-storage-usage-container').empty();