This is an automated email from the ASF dual-hosted git repository.

mattyb149 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new 1473652  NIFI-6801 - fix to ensure unique model instance is created 
for each connection. Also increased default query interval.
1473652 is described below

commit 147365285cbe385a85e58371dd9570dc01683936
Author: Yolanda M. Davis <yolanda.m.da...@gmail.com>
AuthorDate: Wed Oct 23 10:52:26 2019 -0400

    NIFI-6801 - fix to ensure unique model instance is created for each 
connection. Also increased default query interval.
    
    Signed-off-by: Matthew Burgess <mattyb...@apache.org>
    
    This closes #3838
---
 .../org/apache/nifi/controller/FlowController.java |  8 ++----
 .../CachingConnectionStatusAnalyticsEngine.java    |  6 ++---
 .../analytics/ConnectionStatusAnalytics.java       |  2 +-
 .../analytics/ConnectionStatusAnalyticsEngine.java |  7 ++---
 .../analytics/StatusAnalyticsModelMapFactory.java  | 30 +++++++++++++---------
 ...TestCachingConnectionStatusAnalyticsEngine.java | 10 +++-----
 .../TestConnectionStatusAnalyticsEngine.java       |  7 ++---
 .../analytics/TestStatusAnalyticsEngine.java       | 11 +++++---
 .../TestStatusAnalyticsModelMapFactory.java        |  5 ++--
 .../nifi-framework/nifi-resources/pom.xml          |  2 +-
 10 files changed, 42 insertions(+), 46 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
index a6142ec..86cfab9 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
@@ -152,9 +152,7 @@ import 
org.apache.nifi.controller.state.manager.StandardStateManagerProvider;
 import org.apache.nifi.controller.state.server.ZooKeeperStateServer;
 import 
org.apache.nifi.controller.status.analytics.CachingConnectionStatusAnalyticsEngine;
 import org.apache.nifi.controller.status.analytics.StatusAnalyticsEngine;
-import org.apache.nifi.controller.status.analytics.StatusAnalyticsModel;
 import 
org.apache.nifi.controller.status.analytics.StatusAnalyticsModelMapFactory;
-import org.apache.nifi.controller.status.analytics.StatusMetricExtractFunction;
 import org.apache.nifi.controller.status.history.ComponentStatusRepository;
 import org.apache.nifi.controller.status.history.GarbageCollectionHistory;
 import org.apache.nifi.controller.status.history.GarbageCollectionStatus;
@@ -214,7 +212,6 @@ import org.apache.nifi.util.ComponentIdGenerator;
 import org.apache.nifi.util.FormatUtils;
 import org.apache.nifi.util.NiFiProperties;
 import org.apache.nifi.util.ReflectionUtils;
-import org.apache.nifi.util.Tuple;
 import org.apache.nifi.util.concurrency.TimedLock;
 import org.apache.nifi.web.api.dto.PositionDTO;
 import org.apache.nifi.web.api.dto.status.StatusHistoryDTO;
@@ -648,10 +645,9 @@ public class FlowController implements 
ReportingTaskProvider, Authorizable, Node
                 modelScoreThreshold = 
NiFiProperties.DEFAULT_ANALYTICS_CONNECTION_SCORE_THRESHOLD;
             }
 
-            final Map<String, Tuple<StatusAnalyticsModel, 
StatusMetricExtractFunction>> modelMap = StatusAnalyticsModelMapFactory
-                    .getConnectionStatusModelMap(extensionManager, 
nifiProperties);
+            StatusAnalyticsModelMapFactory statusAnalyticsModelMapFactory = 
new StatusAnalyticsModelMapFactory(extensionManager, nifiProperties);
 
-            analyticsEngine = new 
CachingConnectionStatusAnalyticsEngine(flowManager, componentStatusRepository, 
flowFileEventRepository, modelMap,
+            analyticsEngine = new 
CachingConnectionStatusAnalyticsEngine(flowManager, componentStatusRepository, 
flowFileEventRepository, statusAnalyticsModelMapFactory,
                     predictionIntervalMillis, queryIntervalMillis, 
modelScoreName, modelScoreThreshold);
         }
 
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/CachingConnectionStatusAnalyticsEngine.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/CachingConnectionStatusAnalyticsEngine.java
index aa67811..49e8ebe 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/CachingConnectionStatusAnalyticsEngine.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/CachingConnectionStatusAnalyticsEngine.java
@@ -16,13 +16,11 @@
  */
 package org.apache.nifi.controller.status.analytics;
 
-import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.nifi.controller.flow.FlowManager;
 import org.apache.nifi.controller.repository.FlowFileEventRepository;
 import org.apache.nifi.controller.status.history.ComponentStatusRepository;
-import org.apache.nifi.util.Tuple;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,10 +37,10 @@ public class CachingConnectionStatusAnalyticsEngine extends 
ConnectionStatusAnal
     private static final Logger LOG = 
LoggerFactory.getLogger(CachingConnectionStatusAnalyticsEngine.class);
 
     public CachingConnectionStatusAnalyticsEngine(FlowManager flowManager, 
ComponentStatusRepository statusRepository,
-            FlowFileEventRepository flowFileEventRepository, Map<String, 
Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> modelMap,
+            FlowFileEventRepository flowFileEventRepository, 
StatusAnalyticsModelMapFactory statusAnalyticsModelMapFactory,
             long predictionIntervalMillis, long queryIntervalMillis, String 
scoreName, double scoreThreshold) {
 
-        super(flowManager, statusRepository, flowFileEventRepository, 
modelMap, predictionIntervalMillis,
+        super(flowManager, statusRepository, flowFileEventRepository, 
statusAnalyticsModelMapFactory, predictionIntervalMillis,
                            queryIntervalMillis, scoreName, scoreThreshold);
         this.cache = Caffeine.newBuilder()
                 .expireAfterWrite(30, TimeUnit.MINUTES)
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalytics.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalytics.java
index e152339..a524566 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalytics.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalytics.java
@@ -57,7 +57,7 @@ public class ConnectionStatusAnalytics implements 
StatusAnalytics {
     private final Boolean supportOnlineLearning;
     private Boolean extendWindow = false;
     private long intervalMillis = 3L * 60 * 1000; // Default is 3 minutes
-    private long queryIntervalMillis = 3L * 60 * 1000;  //Default is 3 minutes
+    private long queryIntervalMillis = 5L * 60 * 1000;  //Default is 3 minutes
     private String scoreName = "rSquared";
     private double scoreThreshold = .90;
 
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalyticsEngine.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalyticsEngine.java
index e7eecac..282a58f 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalyticsEngine.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/ConnectionStatusAnalyticsEngine.java
@@ -35,20 +35,20 @@ public class ConnectionStatusAnalyticsEngine implements 
StatusAnalyticsEngine {
     protected final ComponentStatusRepository statusRepository;
     protected final FlowManager flowManager;
     protected final FlowFileEventRepository flowFileEventRepository;
-    protected final Map<String, Tuple<StatusAnalyticsModel, 
StatusMetricExtractFunction>> modelMap;
+    protected final StatusAnalyticsModelMapFactory 
statusAnalyticsModelMapFactory;
     protected final long predictionIntervalMillis;
     protected final long queryIntervalMillis;
     protected final String scoreName;
     protected final double scoreThreshold;
 
     public ConnectionStatusAnalyticsEngine(FlowManager flowManager, 
ComponentStatusRepository statusRepository, FlowFileEventRepository 
flowFileEventRepository,
-                                           Map<String, 
Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> modelMap, long 
predictionIntervalMillis,
+                                           StatusAnalyticsModelMapFactory 
statusAnalyticsModelMapFactory, long predictionIntervalMillis,
                                            long queryIntervalMillis, String 
scoreName, double scoreThreshold) {
         this.flowManager = flowManager;
         this.statusRepository = statusRepository;
         this.flowFileEventRepository = flowFileEventRepository;
         this.predictionIntervalMillis = predictionIntervalMillis;
-        this.modelMap = modelMap;
+        this.statusAnalyticsModelMapFactory = statusAnalyticsModelMapFactory;
         this.queryIntervalMillis = queryIntervalMillis;
         this.scoreName = scoreName;
         this.scoreThreshold = scoreThreshold;
@@ -61,6 +61,7 @@ public class ConnectionStatusAnalyticsEngine implements 
StatusAnalyticsEngine {
      */
     @Override
     public StatusAnalytics getStatusAnalytics(String identifier) {
+        Map<String, Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> 
modelMap = statusAnalyticsModelMapFactory.getConnectionStatusModelMap();
         ConnectionStatusAnalytics connectionStatusAnalytics = new 
ConnectionStatusAnalytics(statusRepository, flowManager, 
flowFileEventRepository, modelMap, identifier, false);
         
connectionStatusAnalytics.setIntervalTimeMillis(predictionIntervalMillis);
         connectionStatusAnalytics.setQueryIntervalMillis(queryIntervalMillis);
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/StatusAnalyticsModelMapFactory.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/StatusAnalyticsModelMapFactory.java
index a1e82b2..1a5d351 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/StatusAnalyticsModelMapFactory.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/StatusAnalyticsModelMapFactory.java
@@ -44,20 +44,26 @@ public class StatusAnalyticsModelMapFactory {
     private final static String OUTPUT_COUNT_METRIC = "outputCount";
     private final static String OUTPUT_BYTES_METRIC = "outputBytes";
 
+    final ExtensionManager extensionManager;
+    final NiFiProperties niFiProperties;
+
+    public StatusAnalyticsModelMapFactory(ExtensionManager extensionManager, 
NiFiProperties niFiProperties) {
+        this.extensionManager = extensionManager;
+        this.niFiProperties = niFiProperties;
+    }
+
     /**
      * Return mapping of models and extraction functions for connection status 
analytics prediction instances
-     * @param extensionManager Extension Manager object for instantiating 
classes
-     * @param niFiProperties NiFi Properties object
      * @return
      */
-    public static Map<String, Tuple<StatusAnalyticsModel, 
StatusMetricExtractFunction>> getConnectionStatusModelMap(ExtensionManager 
extensionManager, NiFiProperties niFiProperties){
-            Map<String, Tuple<StatusAnalyticsModel, 
StatusMetricExtractFunction>> modelMap = new HashMap<>();
-            StatusMetricExtractFunction extract = 
getConnectionStatusExtractFunction();
-            Tuple<StatusAnalyticsModel, StatusMetricExtractFunction> 
countModelFunction = new Tuple<>(createModelInstance(extensionManager, 
niFiProperties), extract);
-            Tuple<StatusAnalyticsModel, StatusMetricExtractFunction> 
byteModelFunction = new Tuple<>(createModelInstance(extensionManager, 
niFiProperties), extract);
-            modelMap.put(QUEUED_COUNT_METRIC, countModelFunction);
-            modelMap.put(QUEUED_BYTES_METRIC, byteModelFunction);
-            return modelMap;
+    public Map<String, Tuple<StatusAnalyticsModel, 
StatusMetricExtractFunction>> getConnectionStatusModelMap(){
+        Map<String, Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> 
modelMap = new HashMap<>();
+        StatusMetricExtractFunction extract = 
getConnectionStatusExtractFunction();
+        Tuple<StatusAnalyticsModel, StatusMetricExtractFunction> 
countModelFunction = new Tuple<>(createModelInstance(extensionManager, 
niFiProperties), extract);
+        Tuple<StatusAnalyticsModel, StatusMetricExtractFunction> 
byteModelFunction = new Tuple<>(createModelInstance(extensionManager, 
niFiProperties), extract);
+        modelMap.put(QUEUED_COUNT_METRIC, countModelFunction);
+        modelMap.put(QUEUED_BYTES_METRIC, byteModelFunction);
+        return modelMap;
     }
 
     /**
@@ -66,7 +72,7 @@ public class StatusAnalyticsModelMapFactory {
      * @param nifiProperties NiFi Properties object
      * @return statusAnalyticsModel
      */
-    private static StatusAnalyticsModel createModelInstance(ExtensionManager 
extensionManager, NiFiProperties nifiProperties) {
+    private StatusAnalyticsModel createModelInstance(ExtensionManager 
extensionManager, NiFiProperties nifiProperties) {
         final String implementationClassName = 
nifiProperties.getProperty(NiFiProperties.ANALYTICS_CONNECTION_MODEL_IMPLEMENTATION,
 NiFiProperties.DEFAULT_ANALYTICS_CONNECTION_MODEL_IMPLEMENTATION);
         if (implementationClassName == null) {
             throw new RuntimeException("Cannot create Analytics Model because 
the NiFi Properties is missing the following property: "
@@ -83,7 +89,7 @@ public class StatusAnalyticsModelMapFactory {
      * Get a connection status extract function instance
      * @return StatusMetricExtractFunction
      */
-    private static StatusMetricExtractFunction 
getConnectionStatusExtractFunction() {
+    private StatusMetricExtractFunction getConnectionStatusExtractFunction() {
 
         return (metric, statusHistory) -> {
 
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestCachingConnectionStatusAnalyticsEngine.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestCachingConnectionStatusAnalyticsEngine.java
index 7be0b8a..46988a6 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestCachingConnectionStatusAnalyticsEngine.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestCachingConnectionStatusAnalyticsEngine.java
@@ -19,29 +19,25 @@ package org.apache.nifi.controller.status.analytics;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 
-import java.util.Map;
-
 import org.apache.nifi.controller.flow.FlowManager;
 import org.apache.nifi.controller.repository.FlowFileEventRepository;
 import org.apache.nifi.controller.status.history.ComponentStatusRepository;
-import org.apache.nifi.util.Tuple;
 import org.junit.Test;
 
 public class TestCachingConnectionStatusAnalyticsEngine extends 
TestStatusAnalyticsEngine {
 
     @Override
     public StatusAnalyticsEngine getStatusAnalyticsEngine(FlowManager 
flowManager, FlowFileEventRepository flowFileEventRepository,
-                                                          
ComponentStatusRepository componentStatusRepository,
-                                                          Map<String, 
Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> modelMap,
+                                                          
ComponentStatusRepository componentStatusRepository, 
StatusAnalyticsModelMapFactory statusAnalyticsModelMapFactory,
                                                           long 
predictIntervalMillis, long queryIntervalMillis, String scoreName, double 
scoreThreshold) {
 
-        return new CachingConnectionStatusAnalyticsEngine(flowManager, 
componentStatusRepository, flowFileEventRepository, modelMap, 
predictIntervalMillis,
+        return new CachingConnectionStatusAnalyticsEngine(flowManager, 
componentStatusRepository, flowFileEventRepository, 
statusAnalyticsModelMapFactory, predictIntervalMillis,
                                                                                
                 queryIntervalMillis, scoreName, scoreThreshold);
     }
 
     @Test
     public void testCachedStatusAnalytics() {
-        StatusAnalyticsEngine statusAnalyticsEngine = new 
CachingConnectionStatusAnalyticsEngine(flowManager, statusRepository, 
flowFileEventRepository, modelMap,
+        StatusAnalyticsEngine statusAnalyticsEngine = new 
CachingConnectionStatusAnalyticsEngine(flowManager, statusRepository, 
flowFileEventRepository, statusAnalyticsModelMapFactory,
                                                                                
                     DEFAULT_PREDICT_INTERVAL_MILLIS, 
DEFAULT_QUERY_INTERVAL_MILLIS,
                                                                                
                     DEFAULT_SCORE_NAME, DEFAULT_SCORE_THRESHOLD);
         StatusAnalytics statusAnalyticsA = 
statusAnalyticsEngine.getStatusAnalytics("A");
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestConnectionStatusAnalyticsEngine.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestConnectionStatusAnalyticsEngine.java
index eb56129..e5956e8 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestConnectionStatusAnalyticsEngine.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestConnectionStatusAnalyticsEngine.java
@@ -16,20 +16,17 @@
  */
 package org.apache.nifi.controller.status.analytics;
 
-import java.util.Map;
-
 import org.apache.nifi.controller.flow.FlowManager;
 import org.apache.nifi.controller.repository.FlowFileEventRepository;
 import org.apache.nifi.controller.status.history.ComponentStatusRepository;
-import org.apache.nifi.util.Tuple;
 
 public class TestConnectionStatusAnalyticsEngine extends 
TestStatusAnalyticsEngine {
 
     @Override
     public StatusAnalyticsEngine getStatusAnalyticsEngine(FlowManager 
flowManager, FlowFileEventRepository flowFileEventRepository,
-                                                          
ComponentStatusRepository statusRepository, Map<String, 
Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> modelMap,
+                                                          
ComponentStatusRepository statusRepository,  StatusAnalyticsModelMapFactory 
statusAnalyticsModelMapFactory,
                                                             long 
predictIntervalMillis, long queryIntervalMillis, String scoreName, double 
scoreThreshold) {
-        return new ConnectionStatusAnalyticsEngine(flowManager, 
statusRepository, flowFileEventRepository,modelMap,
+        return new ConnectionStatusAnalyticsEngine(flowManager, 
statusRepository, flowFileEventRepository,statusAnalyticsModelMapFactory,
                                                    
DEFAULT_PREDICT_INTERVAL_MILLIS, DEFAULT_QUERY_INTERVAL_MILLIS, scoreName, 
scoreThreshold);
     }
 
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsEngine.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsEngine.java
index f1dc0be..9796643 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsEngine.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsEngine.java
@@ -50,15 +50,16 @@ public abstract class TestStatusAnalyticsEngine {
     protected ComponentStatusRepository statusRepository;
     protected FlowManager flowManager;
     protected FlowFileEventRepository flowFileEventRepository;
-    protected Map<String, Tuple<StatusAnalyticsModel, 
StatusMetricExtractFunction>> modelMap;
+    protected  StatusAnalyticsModelMapFactory statusAnalyticsModelMapFactory;
 
     @Before
     public void setup() {
 
         statusRepository = Mockito.mock(ComponentStatusRepository.class);
         flowManager = Mockito.mock(FlowManager.class);
-        modelMap = new HashMap<>();
+        statusAnalyticsModelMapFactory = 
Mockito.mock(StatusAnalyticsModelMapFactory.class);
 
+        Map<String, Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> 
modelMap = new HashMap<>();
         StatusAnalyticsModel countModel = 
Mockito.mock(StatusAnalyticsModel.class);
         StatusAnalyticsModel byteModel = 
Mockito.mock(StatusAnalyticsModel.class);
         StatusMetricExtractFunction extractFunction = 
Mockito.mock(StatusMetricExtractFunction.class);
@@ -75,6 +76,8 @@ public abstract class TestStatusAnalyticsEngine {
         StatusHistory statusHistory = Mockito.mock(StatusHistory.class);
         StatusSnapshot statusSnapshot = Mockito.mock(StatusSnapshot.class);
 
+        
when(statusAnalyticsModelMapFactory.getConnectionStatusModelMap()).thenReturn(modelMap);
+
         
when(extractFunction.extractMetric(anyString(),any(StatusHistory.class))).then(new
 Answer<Tuple<Stream<Double[]>,Stream<Double>>>() {
             @Override
             public Tuple<Stream<Double[]>, Stream<Double>> 
answer(InvocationOnMock invocationOnMock) throws Throwable {
@@ -89,14 +92,14 @@ public abstract class TestStatusAnalyticsEngine {
 
     @Test
     public void testGetStatusAnalytics() {
-        StatusAnalyticsEngine statusAnalyticsEngine = 
getStatusAnalyticsEngine(flowManager,flowFileEventRepository, statusRepository, 
modelMap, DEFAULT_PREDICT_INTERVAL_MILLIS,
+        StatusAnalyticsEngine statusAnalyticsEngine = 
getStatusAnalyticsEngine(flowManager,flowFileEventRepository, statusRepository, 
statusAnalyticsModelMapFactory, DEFAULT_PREDICT_INTERVAL_MILLIS,
                                                                                
 DEFAULT_QUERY_INTERVAL_MILLIS, DEFAULT_SCORE_NAME, DEFAULT_SCORE_THRESHOLD);
         StatusAnalytics statusAnalytics = 
statusAnalyticsEngine.getStatusAnalytics("1");
         assertNotNull(statusAnalytics);
     }
 
     public abstract StatusAnalyticsEngine getStatusAnalyticsEngine(FlowManager 
flowManager, FlowFileEventRepository flowFileEventRepository,
-                                                                   
ComponentStatusRepository componentStatusRepository, Map<String, 
Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>>  modelMap,
+                                                                   
ComponentStatusRepository componentStatusRepository, 
StatusAnalyticsModelMapFactory statusAnalyticsModelMapFactory,
                                                                     long 
predictIntervalMillis, long queryIntervalMillis, String scoreName, double 
scoreThreshold);
 
 }
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsModelMapFactory.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsModelMapFactory.java
index 98b253a..2f5127d 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsModelMapFactory.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestStatusAnalyticsModelMapFactory.java
@@ -51,9 +51,8 @@ public class TestStatusAnalyticsModelMapFactory {
 
     @Test
     public void getConnectionStatusModelMap() {
-        Map<String, Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> 
modelMap = StatusAnalyticsModelMapFactory
-                .getConnectionStatusModelMap(extensionManager, nifiProperties);
-
+        StatusAnalyticsModelMapFactory factory = new 
StatusAnalyticsModelMapFactory(extensionManager,nifiProperties);
+        Map<String, Tuple<StatusAnalyticsModel, StatusMetricExtractFunction>> 
modelMap = factory.getConnectionStatusModelMap();
         assertNotNull(modelMap.get("queuedCount"));
         assertNotNull(modelMap.get("queuedBytes"));
         StatusAnalyticsModel countModel = modelMap.get("queuedCount").getKey();
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml
index 56bd941..4e86e9f 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml
@@ -212,7 +212,7 @@
         <!-- nifi.properties: analytics properties -->
         <nifi.analytics.predict.enabled>false</nifi.analytics.predict.enabled>
         <nifi.analytics.predict.interval>3 
mins</nifi.analytics.predict.interval>
-        <nifi.analytics.query.interval>3 mins</nifi.analytics.query.interval>
+        <nifi.analytics.query.interval>5 mins</nifi.analytics.query.interval>
         
<nifi.analytics.connection.model.implementation>org.apache.nifi.controller.status.analytics.models.OrdinaryLeastSquares</nifi.analytics.connection.model.implementation>
         
<nifi.analytics.connection.model.score.name>rSquared</nifi.analytics.connection.model.score.name>
         
<nifi.analytics.connection.model.score.threshold>.90</nifi.analytics.connection.model.score.threshold>

Reply via email to