mattyb149 commented on a change in pull request #3681: NIFI-6510 - Analytics 
framework
URL: https://github.com/apache/nifi/pull/3681#discussion_r320984178
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
 ##########
 @@ -1178,16 +1183,63 @@ public ConnectionStatusDTO 
createConnectionStatusDto(final ConnectionStatus conn
 
         if (connectionStatus.getBackPressureObjectThreshold() > 0) {
             snapshot.setPercentUseCount(Math.min(100, 
StatusMerger.getUtilization(connectionStatus.getQueuedCount(), 
connectionStatus.getBackPressureObjectThreshold())));
+
+            snapshot.setPredictionIntervalSeconds(((Long) 
(connectionStatus.getPredictionIntervalMillis() / 1000L)).intValue());
+            
snapshot.setPredictedMillisUntilCountBackpressure(connectionStatus.getPredictedTimeToCountBackpressureMillis());
+            
snapshot.setPredictedCountAtNextInterval(connectionStatus.getNextPredictedQueuedCount());
+            
snapshot.setPredictedPercentCount(connectionStatus.getPredictedPercentCount());
+            
snapshot.setPredictedPercentBytes(connectionStatus.getPredictedPercentBytes());
+            
snapshot.setPredictionIntervalSeconds(((Long)(connectionStatus.getPredictionIntervalMillis()
 / 1000L)).intValue());
         }
         if (connectionStatus.getBackPressureBytesThreshold() > 0) {
             snapshot.setPercentUseBytes(Math.min(100, 
StatusMerger.getUtilization(connectionStatus.getQueuedBytes(), 
connectionStatus.getBackPressureBytesThreshold())));
+
+            snapshot.setPredictionIntervalSeconds(((Long) 
(connectionStatus.getPredictionIntervalMillis() / 1000L)).intValue());
+            
snapshot.setPredictedMillisUntilBytesBackpressure(connectionStatus.getPredictedTimeToBytesBackpressureMillis());
+            
snapshot.setPredictedBytesAtNextInterval(connectionStatus.getNextPredictedQueuedBytes());
+            
snapshot.setPredictedPercentCount(connectionStatus.getPredictedPercentCount());
+            
snapshot.setPredictedPercentBytes(connectionStatus.getPredictedPercentBytes());
+            
snapshot.setPredictionIntervalSeconds(((Long)(connectionStatus.getPredictionIntervalMillis()
 / 1000L)).intValue());
         }
 
         StatusMerger.updatePrettyPrintedFields(snapshot);
 
         return connectionStatusDto;
     }
 
+    public ConnectionStatisticsDTO createConnectionStatisticsDto(final 
Connection connection, final StatusAnalytics statusAnalytics) {
+        final ConnectionStatisticsDTO connectionStatisticsDTO = new 
ConnectionStatisticsDTO();
+
+        
connectionStatisticsDTO.setGroupId(connection.getProcessGroup().getIdentifier());
+        connectionStatisticsDTO.setId(connection.getIdentifier());
+        connectionStatisticsDTO.setName(connection.getName());
 
 Review comment:
   I pretty much copied this part from `createConnectionStatusDto()` above, 
which doesn't appear to have those authorizations either but does seem to 
include connection information. I assume we should make the same change there?

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to