lindong28 commented on code in PR #21579:
URL: https://github.com/apache/flink/pull/21579#discussion_r1062395605


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ChainingOutput.java:
##########
@@ -40,33 +38,24 @@
     private static final Logger LOG = 
LoggerFactory.getLogger(ChainingOutput.class);
 
     protected final Input<T> input;
+    protected final Counter numRecordsOut;
     protected final Counter numRecordsIn;
     protected final WatermarkGauge watermarkGauge = new WatermarkGauge();
     @Nullable protected final OutputTag<T> outputTag;
     protected WatermarkStatus announcedStatus = WatermarkStatus.ACTIVE;
 
-    public ChainingOutput(OneInputStreamOperator<T, ?> operator, @Nullable 
OutputTag<T> outputTag) {
-        this(operator, operator.getMetricGroup(), outputTag);
-    }
-
     public ChainingOutput(
             Input<T> input,
-            OperatorMetricGroup operatorMetricGroup,
+            @Nullable Counter prevNumRecordsOut,
+            OperatorMetricGroup curOperatorMetricGroup,
             @Nullable OutputTag<T> outputTag) {
         this.input = input;
-
-        {
-            Counter tmpNumRecordsIn;
-            try {
-                OperatorIOMetricGroup ioMetricGroup = 
operatorMetricGroup.getIOMetricGroup();
-                tmpNumRecordsIn = ioMetricGroup.getNumRecordsInCounter();
-            } catch (Exception e) {
-                LOG.warn("An exception occurred during the metrics setup.", e);
-                tmpNumRecordsIn = new SimpleCounter();
-            }
-            numRecordsIn = tmpNumRecordsIn;
+        if (prevNumRecordsOut != null) {
+            this.numRecordsOut = prevNumRecordsOut;
+        } else {
+            this.numRecordsOut = new SimpleCounter();

Review Comment:
   Sure. The comment is added.



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