Yang-LI-CS commented on code in PR #743:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/743#discussion_r1440202523


##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/metrics/ScalingMetrics.java:
##########
@@ -216,15 +216,20 @@ private static double getNumRecordsInPerSecond(
             Map<FlinkMetric, AggregatedMetric> flinkMetrics,
             JobVertexID jobVertexID,
             boolean isSource) {
+        // If the vertex is not the source, use NUM_RECORDS_IN_PER_SEC metric
         var numRecordsInPerSecond = 
flinkMetrics.get(FlinkMetric.NUM_RECORDS_IN_PER_SEC);
+        // If the vertex is the source, use SOURCE_TASK_NUM_RECORDS_IN_PER_SEC 
metric
         if (isSource && (numRecordsInPerSecond == null || 
numRecordsInPerSecond.getSum() == 0)) {
             numRecordsInPerSecond =
                     
flinkMetrics.get(FlinkMetric.SOURCE_TASK_NUM_RECORDS_IN_PER_SEC);
         }
+        // If the vertex is the source and SOURCE_TASK_NUM_RECORDS_IN_PER_SEC 
metric not available
+        // then use SOURCE_TASK_NUM_RECORDS_OUT_PER_SEC metric
         if (isSource && (numRecordsInPerSecond == null || 
numRecordsInPerSecond.getSum() == 0)) {
             numRecordsInPerSecond =
                     
flinkMetrics.get(FlinkMetric.SOURCE_TASK_NUM_RECORDS_OUT_PER_SEC);
         }

Review Comment:
   Good idea! 🙏 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to