nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joew...@apache.org
Subject [2/2] nifi git commit: NIFI-1298: - Addressing too many significant digits in the processor load average and [non]heap utilization.
Date Fri, 18 Dec 2015 22:20:34 GMT
NIFI-1298: - Addressing too many significant digits in the processor load average and [non]heap
utilization.

Signed-off-by: joewitt <joewitt@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/43c7ecd2
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/43c7ecd2
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/43c7ecd2

Branch: refs/heads/master
Commit: 43c7ecd221a5c3253562ec4805719b9848002a71
Parents: 0436383
Author: Matt Gilman <matt.c.gilman@gmail.com>
Authored: Fri Dec 18 16:50:03 2015 -0500
Committer: joewitt <joewitt@apache.org>
Committed: Fri Dec 18 17:02:40 2015 -0500

----------------------------------------------------------------------
 .../nifi/diagnostics/SystemDiagnostics.java     | 12 +++++++--
 .../org/apache/nifi/web/api/dto/DtoFactory.java |  8 ++++--
 .../summary/system-diagnostics-dialog.jsp       |  4 +--
 .../webapp/js/nf/summary/nf-summary-table.js    | 26 +++++++++++++++++---
 4 files changed, 40 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/43c7ecd2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnostics.java
----------------------------------------------------------------------
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 2d77e70..7b50ebc 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<String, GarbageCollection> getGarbageCollection() {

http://git-wip-us.apache.org/repos/asf/nifi/blob/43c7ecd2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
----------------------------------------------------------------------
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 f26d1b7..a2619e6 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());

http://git-wip-us.apache.org/repos/asf/nifi/blob/43c7ecd2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/system-diagnostics-dialog.jsp
----------------------------------------------------------------------
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 d49f607..577c1d8 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 @@
             <div class="settings-left">
                 <div class="setting">
                     <input type="hidden" id=""/>
-                    <div class="setting-name">Heap (<span id="utilization-heap"></span>)</div>
+                    <div class="setting-name">Heap <span id="utilization-heap"></span></div>
                     <div class="setting-field">
                         <table id="heap-table">
                             <tbody>
@@ -57,7 +57,7 @@
             </div>
             <div class="settings-right">
                 <div class="setting">
-                    <div class="setting-name">Non heap (<span id="utilization-non-heap"></span>)</div>
+                    <div class="setting-name">Non heap <span id="utilization-non-heap"></span></div>
                     <div class="setting-field">
                         <table id="heap-table">
                             <tbody>

http://git-wip-us.apache.org/repos/asf/nifi/blob/43c7ecd2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js
----------------------------------------------------------------------
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 fe4ed91..156ad4c 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();


Mime
View raw message