wenlong88 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_r401327542
##########
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:
`NetworkBufferPool#redistributeBuffers` reduce the buffer available only
when new task deployed right? I think it can be ignored, because we use meter
to measure average idle time which use a time window by default 60s, so the
side effect can be ignored.
----------------------------------------------------------------
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