[
https://issues.apache.org/jira/browse/FLINK-33966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yang LI updated FLINK-33966:
----------------------------
Description:
We have following code in the codebase
{code:java}
if (isSource && (numRecordsInPerSecond == null ||
numRecordsInPerSecond.getSum() == 0)) {
numRecordsInPerSecond =
flinkMetrics.get(FlinkMetric.SOURCE_TASK_NUM_RECORDS_IN_PER_SEC);
}{code}
{code:java}
if (isSource && (numRecordsInPerSecond == null ||
numRecordsInPerSecond.getSum() == 0)) {
numRecordsInPerSecond =
flinkMetrics.get(FlinkMetric.SOURCE_TASK_NUM_RECORDS_OUT_PER_SEC);
}{code}
with two times the same condition check
{*}Definition of done{*}:
Update getNumRecordsInPerSecond'{{{}s{}}} second {{if}} condition from {{if
(isSource && ...)}} to {{{}if (!isSource && ...){}}}. This addresses the
redundant check and ensures correct metric fetching for non-source operators.
was:
We have 2 times the same condition check in the function
getNumRecordsInPerSecond
([L220|https://github.com/apache/flink-kubernetes-operator/blob/main/flink-autoscaler/src/main/java/org/apache/flink/autoscaler/metrics/ScalingMetrics.java#L220]
and
[L224|https://github.com/apache/flink-kubernetes-operator/blob/main/flink-autoscaler/src/main/java/org/apache/flink/autoscaler/metrics/ScalingMetrics.java#L224])
{*}Definition of done{*}:
Update getNumRecordsInPerSecond'{{{}s{}}} second {{if}} condition from {{if
(isSource && ...)}} to {{{}if (!isSource && ...){}}}. This addresses the
redundant check and ensures correct metric fetching for non-source operators.
> Fix the getNumRecordsInPerSecond Utility Function
> -------------------------------------------------
>
> Key: FLINK-33966
> URL: https://issues.apache.org/jira/browse/FLINK-33966
> Project: Flink
> Issue Type: Bug
> Components: Autoscaler
> Affects Versions: kubernetes-operator-1.7.0
> Reporter: Yang LI
> Priority: Minor
>
> We have following code in the codebase
> {code:java}
> if (isSource && (numRecordsInPerSecond == null ||
> numRecordsInPerSecond.getSum() == 0)) {
> numRecordsInPerSecond =
>
> flinkMetrics.get(FlinkMetric.SOURCE_TASK_NUM_RECORDS_IN_PER_SEC);
> }{code}
> {code:java}
> if (isSource && (numRecordsInPerSecond == null ||
> numRecordsInPerSecond.getSum() == 0)) {
> numRecordsInPerSecond =
>
> flinkMetrics.get(FlinkMetric.SOURCE_TASK_NUM_RECORDS_OUT_PER_SEC);
> }{code}
> with two times the same condition check
>
> {*}Definition of done{*}:
> Update getNumRecordsInPerSecond'{{{}s{}}} second {{if}} condition from {{if
> (isSource && ...)}} to {{{}if (!isSource && ...){}}}. This addresses the
> redundant check and ensures correct metric fetching for non-source operators.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)