mxm commented on code in PR #743:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/743#discussion_r1440322610
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/metrics/ScalingMetrics.java:
##########
@@ -216,15 +216,21 @@ private static double getNumRecordsInPerSecond(
Map<FlinkMetric, AggregatedMetric> flinkMetrics,
JobVertexID jobVertexID,
boolean isSource) {
+ // Generate numRecordsInPerSecond from 3 metrics:
+ // 1. If the vertex is not the source, use NUM_RECORDS_IN_PER_SEC
metric
var numRecordsInPerSecond =
flinkMetrics.get(FlinkMetric.NUM_RECORDS_IN_PER_SEC);
+ // 2. If the vertex is the source, use
SOURCE_TASK_NUM_RECORDS_IN_PER_SEC metric first.
if (isSource && (numRecordsInPerSecond == null ||
numRecordsInPerSecond.getSum() == 0)) {
numRecordsInPerSecond =
flinkMetrics.get(FlinkMetric.SOURCE_TASK_NUM_RECORDS_IN_PER_SEC);
}
+ // 3. 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
Review Comment:
```suggestion
// 3. If the vertex contains a source operator which does not emit
input metrics, use output metrics instead.
// then use SOURCE_TASK_NUM_RECORDS_OUT_PER_SEC metric
```
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/metrics/ScalingMetrics.java:
##########
@@ -216,15 +216,21 @@ private static double getNumRecordsInPerSecond(
Map<FlinkMetric, AggregatedMetric> flinkMetrics,
JobVertexID jobVertexID,
boolean isSource) {
+ // Generate numRecordsInPerSecond from 3 metrics:
+ // 1. If the vertex is not the source, use NUM_RECORDS_IN_PER_SEC
metric
var numRecordsInPerSecond =
flinkMetrics.get(FlinkMetric.NUM_RECORDS_IN_PER_SEC);
+ // 2. If the vertex is the source, use
SOURCE_TASK_NUM_RECORDS_IN_PER_SEC metric first.
if (isSource && (numRecordsInPerSecond == null ||
numRecordsInPerSecond.getSum() == 0)) {
Review Comment:
```suggestion
// 2. If the former is unavailable and the vertex contains a source
operator, use the corresponding source operator metric.
if (isSource && (numRecordsInPerSecond == null ||
numRecordsInPerSecond.getSum() == 0)) {
```
##########
flink-autoscaler/src/main/java/org/apache/flink/autoscaler/metrics/ScalingMetrics.java:
##########
@@ -216,15 +216,21 @@ private static double getNumRecordsInPerSecond(
Map<FlinkMetric, AggregatedMetric> flinkMetrics,
JobVertexID jobVertexID,
boolean isSource) {
+ // Generate numRecordsInPerSecond from 3 metrics:
+ // 1. If the vertex is not the source, use NUM_RECORDS_IN_PER_SEC
metric
var numRecordsInPerSecond =
flinkMetrics.get(FlinkMetric.NUM_RECORDS_IN_PER_SEC);
Review Comment:
```suggestion
// 1. If available, directly use the NUM_RECORDS_IN_PER_SEC task
metric.
var numRecordsInPerSecond =
flinkMetrics.get(FlinkMetric.NUM_RECORDS_IN_PER_SEC);
```
--
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]