mcgilman commented on a change in pull request #4420: URL: https://github.com/apache/nifi/pull/4420#discussion_r475689496
########## File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/NodeStatusDescriptor.java ########## @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.controller.status.history; + +import org.apache.nifi.controller.status.NodeStatus; + +import java.util.List; + +public enum NodeStatusDescriptor { + FREE_HEAP( + "freeHeap", + "Free Heap", + "The amount of free memory in the heap that can be used by the Java virtual machine.", + MetricDescriptor.Formatter.DATA_SIZE, + s -> s.getFreeHeap()), + USED_HEAP( + "usedHeap", + "Used Heap", + "The amount of used memory in the heap that is used by the Java virtual machine.", + MetricDescriptor.Formatter.DATA_SIZE, + s -> s.getUsedHeap()), + HEAP_UTILIZATION( + "heapUtilization", + "Heap Utilization", + "The percentage of available heap currently used by the Java virtual machine.", + MetricDescriptor.Formatter.COUNT, + s -> s.getHeapUtilization(), + new ValueReducer<StatusSnapshot, Long>() { + @Override + public Long reduce(final List<StatusSnapshot> values) { + long sumUtilization = 0L; + int invocations = 0; + + for (final StatusSnapshot snapshot : values) { + final Long utilization = snapshot.getStatusMetric(HEAP_UTILIZATION.getDescriptor()); + if (utilization != null) { + sumUtilization += utilization.longValue(); + invocations++; + } + } + + if (invocations == 0) { + return 0L; + } + + return sumUtilization / invocations; + } + }), + FREE_NON_HEAP( + "freeNonHeap", + "Free Non Heap", + "The currently available non-heap memory that can be used by the Java virtual machine.", + MetricDescriptor.Formatter.DATA_SIZE, + s -> s.getFreeNonHeap()), + USED_NON_HEAP( + "usedNonHeap", + "Used Non Heap", + "The current memory usage of non-heap memory that is used by the Java virtual machine.", + MetricDescriptor.Formatter.DATA_SIZE, + s -> s.getUsedNonHeap()), + OPEN_FILE_HANDLERS( + "openFileHandlers", + "Open File Handlers", + "The current number of open file descriptors used by the Java virtual machine.", + MetricDescriptor.Formatter.COUNT, + s -> s.getOpenFileHandlers()), + PROCESSOR_LOAD_AVERAGE( + "processorLoadAverage", + "Processor Load Average", + "The processor load. Every measurement point represents te system load average for the last minute.", Review comment: Typo `te`. ########## File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js ########## @@ -78,6 +79,9 @@ }, 'DATA_SIZE': function (d) { return nfCommon.formatDataSize(d); + }, + 'FRACTION': function (d) { + return nfCommon.formatFloat(d / 1000000); Review comment: I saw there is a metric multiplier that is applied server-side and the comment indicates that this operation is needed before presenting the value to a user. However, I'm not quite following upon first review. Can you elaborate on this a little more and explain why it's needed? Just a little worried that we have a magic number here with no reference to the fraction multiplier being applied server-side. ---------------------------------------------------------------- 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]
