pnowojski commented on a change in pull request #11564: [FLINK-16864][metrics] 
Add IdleTime metric for task.
URL: https://github.com/apache/flink/pull/11564#discussion_r404785105
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java
 ##########
 @@ -276,6 +281,21 @@ protected void checkErroneous() throws IOException {
                }
        }
 
+       protected void addBufferConsumer(BufferConsumer consumer, int 
targetChannel) throws IOException {
+               targetPartition.addBufferConsumer(consumer, targetChannel);
+       }
+
+       protected BufferBuilder getBufferBuilder() throws IOException, 
InterruptedException {
+               BufferBuilder builder;
+               if (!targetPartition.isApproximatelyAvailable()) {
+                       long start = System.currentTimeMillis();
+                       builder = targetPartition.getBufferBuilder();
+                       
idleTimeMsPerSecond.markEvent(System.currentTimeMillis() - start);
+               } else {
+                       builder = targetPartition.getBufferBuilder();
+               }
+               return builder;
+       }
 
 Review comment:
   Thanks for the update!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to