simonbence commented on a change in pull request #4821:
URL: https://github.com/apache/nifi/pull/4821#discussion_r578221925
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/VolatileComponentStatusRepository.java
##########
@@ -16,412 +16,86 @@
*/
package org.apache.nifi.controller.status.history;
-import org.apache.nifi.controller.status.ConnectionStatus;
import org.apache.nifi.controller.status.NodeStatus;
import org.apache.nifi.controller.status.ProcessGroupStatus;
-import org.apache.nifi.controller.status.ProcessorStatus;
-import org.apache.nifi.controller.status.RemoteProcessGroupStatus;
-import org.apache.nifi.util.ComponentMetrics;
import org.apache.nifi.util.NiFiProperties;
-import org.apache.nifi.util.RingBuffer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-public class VolatileComponentStatusRepository implements
ComponentStatusRepository {
- private static final Logger logger =
LoggerFactory.getLogger(VolatileComponentStatusRepository.class);
-
- private static final Set<MetricDescriptor<?>> DEFAULT_PROCESSOR_METRICS =
Arrays.stream(ProcessorStatusDescriptor.values())
- .map(ProcessorStatusDescriptor::getDescriptor)
- .collect(Collectors.toSet());
- private static final Set<MetricDescriptor<?>> DEFAULT_CONNECTION_METRICS =
Arrays.stream(ConnectionStatusDescriptor.values())
- .map(ConnectionStatusDescriptor::getDescriptor)
- .collect(Collectors.toSet());
- private static final Set<MetricDescriptor<?>> DEFAULT_GROUP_METRICS =
Arrays.stream(ProcessGroupStatusDescriptor.values())
- .map(ProcessGroupStatusDescriptor::getDescriptor)
- .collect(Collectors.toSet());
- private static final Set<MetricDescriptor<?>> DEFAULT_RPG_METRICS =
Arrays.stream(RemoteProcessGroupStatusDescriptor.values())
- .map(RemoteProcessGroupStatusDescriptor::getDescriptor)
- .collect(Collectors.toSet());
- private static final Set<MetricDescriptor<NodeStatus>>
DEFAULT_NODE_METRICS = Arrays.stream(NodeStatusDescriptor.values())
- .map(NodeStatusDescriptor::getDescriptor)
- .collect(Collectors.toSet());
-
- private static final String STORAGE_FREE_DESCRIPTION = "The usable space
available for use by the underlying storage mechanism.";
- private static final String STORAGE_USED_DESCRIPTION = "The space in use
on the underlying storage mechanism";
-
- private static final String GC_TIME_DESCRIPTION = "The sum time the
garbage collection has run since the start of the Java virtual machine.";
- private static final String GC_TIME_DIFF_DESCRIPTION = "The sum time the
garbage collection has run since the last measurement.";
- private static final String GC_COUNT_DESCRIPTION = "The sum amount of
occasions the garbage collection has run since the start of the Java virtual
machine.";
- private static final String GC_COUNT_DIFF_DESCRIPTION = "The sum amount of
occasions the garbage collection has run since the last measurement.";
-
- public static final String NUM_DATA_POINTS_PROPERTY =
"nifi.components.status.repository.buffer.size";
- public static final int DEFAULT_NUM_DATA_POINTS = 288; // 1 day worth of
5-minute snapshots
-
- private final Map<String, ComponentStatusHistory> componentStatusHistories
= new HashMap<>();
+/**
+ * Consists of in memory repositories for node and component status history.
+ * Necessary in order to support existing way of NiFi configuration.
+ */
+@Deprecated
+public class VolatileComponentStatusRepository implements StatusRepository {
- // Changed to protected to allow unit testing
- protected final RingBuffer<Date> timestamps;
- private final RingBuffer<List<GarbageCollectionStatus>> gcStatuses;
- private final RingBuffer<NodeStatus> nodeStatuses;
- private final int numDataPoints;
- private volatile long lastCaptureTime = 0L;
+ private final NodeStatusRepository nodeStatusRepository;
+ private final ComponentStatusRepository componentStatusRepository;
Review comment:
You are right with that, however the instance creation is managed by the
`InMemoryStatusRepositoryBuilder`, which is an implementation for
`StatusRepositoryBuilder`. This comes with that it will not expose the
implementation class it returns with and I wish not to expose that. (Also:
adding an other way to create the instances would bring in code duplication and
unnecessary complexity in my opinion)
----------------------------------------------------------------
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]