wanglijie95 commented on code in PR #21111:
URL: https://github.com/apache/flink/pull/21111#discussion_r1005237404


##########
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/IOMetrics.java:
##########
@@ -42,30 +47,52 @@ public class IOMetrics implements Serializable {
     protected double accumulateBusyTime;
     protected long accumulateIdleTime;
 
-    protected final Map<IntermediateResultPartitionID, Long> 
numBytesProducedOfPartitions =
-            new HashMap<>();
+    @Nullable
+    protected Map<IntermediateResultPartitionID, ResultPartitionBytes> 
resultPartitionBytes;
 
     public IOMetrics(
             Meter recordsIn,
             Meter recordsOut,
             Meter bytesIn,
             Meter bytesOut,
-            Map<IntermediateResultPartitionID, Counter> 
numBytesProducedCounters,
             Gauge<Long> accumulatedBackPressuredTime,
             Gauge<Long> accumulatedIdleTime,
-            Gauge<Double> accumulatedBusyTime) {
+            Gauge<Double> accumulatedBusyTime,
+            Map<IntermediateResultPartitionID, ResultPartitionBytesCounter>
+                    resultPartitionBytesCounters) {
         this.numRecordsIn = recordsIn.getCount();
         this.numRecordsOut = recordsOut.getCount();
         this.numBytesIn = bytesIn.getCount();
         this.numBytesOut = bytesOut.getCount();
         this.accumulateBackPressuredTime = 
accumulatedBackPressuredTime.getValue();
         this.accumulateBusyTime = accumulatedBusyTime.getValue();
         this.accumulateIdleTime = accumulatedIdleTime.getValue();
+        this.resultPartitionBytes =
+                resultPartitionBytesCounters.entrySet().stream()
+                        .collect(
+                                Collectors.toMap(
+                                        Map.Entry::getKey,
+                                        entry -> 
entry.getValue().createSnapshot()));
+    }
 
-        for (Map.Entry<IntermediateResultPartitionID, Counter> counter :
-                numBytesProducedCounters.entrySet()) {
-            numBytesProducedOfPartitions.put(counter.getKey(), 
counter.getValue().getCount());
-        }
+    public IOMetrics(
+            long numBytesIn,
+            long numBytesOut,
+            long numRecordsIn,
+            long numRecordsOut,
+            long accumulateIdleTime,
+            double accumulateBusyTime,
+            long accumulateBackPressuredTime,
+            @Nullable
+                    Map<IntermediateResultPartitionID, ResultPartitionBytes> 
resultPartitionBytes) {
+        this.numBytesIn = numBytesIn;
+        this.numBytesOut = numBytesOut;
+        this.numRecordsIn = numRecordsIn;
+        this.numRecordsOut = numRecordsOut;
+        this.accumulateIdleTime = accumulateIdleTime;
+        this.accumulateBusyTime = accumulateBusyTime;
+        this.accumulateBackPressuredTime = accumulateBackPressuredTime;
+        this.resultPartitionBytes = resultPartitionBytes;
     }
 
     public IOMetrics(

Review Comment:
   Fixed



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