simonbence commented on a change in pull request #4420:
URL: https://github.com/apache/nifi/pull/4420#discussion_r484373564
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/VolatileComponentStatusRepository.java
##########
@@ -164,6 +183,182 @@ public StatusHistory
getRemoteProcessGroupStatusHistory(final String remoteGroup
return getStatusHistory(remoteGroupId, true, DEFAULT_RPG_METRICS,
start, end, preferredDataPoints);
}
+ @Override
+ public StatusHistory getNodeStatusHistory() {
+ final List<NodeStatus> nodeStatusList = nodeStatuses.asList();
+ final List<List<GarbageCollectionStatus>> gcStatusList =
gcStatuses.asList();
+ final LinkedList<StatusSnapshot> snapshots = new LinkedList<>();
+
+ final Set<MetricDescriptor<?>> metricDescriptors = new
HashSet<>(DEFAULT_NODE_METRICS);
+ final List<MetricDescriptor<List<GarbageCollectionStatus>>>
gcMetricDescriptors = new LinkedList<>();
+ final List<MetricDescriptor<List<GarbageCollectionStatus>>>
gcMetricDescriptorsDifferential = new LinkedList<>();
+ final List<MetricDescriptor<NodeStatus>>
contentStorageStatusDescriptors = new LinkedList<>();
+ final List<MetricDescriptor<NodeStatus>>
provenanceStorageStatusDescriptors = new LinkedList<>();
+
+ int ordinal = DEFAULT_NODE_METRICS.size() - 1;
+
+ // Uses the first measurement as reference for repository metrics
descriptors
+ if (nodeStatusList.size() > 0) {
+ final NodeStatus referenceNodeStatus = nodeStatusList.get(0);
+ int contentStorageNumber = 0;
+ int provenanceStorageNumber = 0;
+
+ for (int i = 0; i <
referenceNodeStatus.getContentRepositories().size(); i++) {
+ final int storageNumber = i;
+ final int counter = metricDescriptors.size() - 1 +
NUMBER_OF_STORAGE_METRICS * contentStorageNumber;
+
+ contentStorageStatusDescriptors.add(new
StandardMetricDescriptor<>(
Review comment:
I reworked this part a bit. Mainly simplification. Also I extracted the
descriptor creation parts to make the flow easier to read.
----------------------------------------------------------------
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]