markap14 commented on a change in pull request #3681: NIFI-6510 - Analytics
framework
URL: https://github.com/apache/nifi/pull/3681#discussion_r321803523
##########
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:
Actually digging into this a bit more I think it is okay in terms of
authorization. Because of the way that ConnectionStatus gets generated, the
authorization is done when the Status object is being generated. Typically, we
handle authorizations at the DTO level instead. Not sure off the top of my head
why it's done that way in this case. Perhaps it could be revisited in the
future.
That said, looking at this, I don't think we actually need the name of the
connection, or the source component's name or id, or the destination's name or
id. We really just need the ID, maybe the group ID, refresh time, and the
predictions. We should avoid including any extra information that is not
needed, because it adds to the overhead of processing (bandwidth, CPU for
serializing/deserializing/compressing/decompressing, etc.) We can always add
things in later if we need them. But once we release with this, we can't really
take them out because it would be a breaking change in terms of backward
compatibility.
----------------------------------------------------------------
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