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

 ##########
 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());
+        
connectionStatisticsDTO.setSourceId(connection.getSource().getIdentifier());
+        
connectionStatisticsDTO.setSourceName(connection.getSource().getName());
+        
connectionStatisticsDTO.setDestinationId(connection.getDestination().getIdentifier());
+        
connectionStatisticsDTO.setDestinationName(connection.getDestination().getName());
+        connectionStatisticsDTO.setStatsLastRefreshed(new Date());
+
+        final ConnectionStatisticsSnapshotDTO snapshot = new 
ConnectionStatisticsSnapshotDTO();
+        connectionStatisticsDTO.setAggregateSnapshot(snapshot);
+
+        snapshot.setId(connection.getIdentifier());
+        snapshot.setGroupId(connection.getProcessGroup().getIdentifier());
+        snapshot.setName(connection.getName());
 
 Review comment:
   The same applies here for the name of the connection, the name of the 
source, and the name of the destination.

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