StephanEwen commented on a change in pull request #13920:
URL: https://github.com/apache/flink/pull/13920#discussion_r520580633



##########
File path: 
flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/SourceReaderBase.java
##########
@@ -114,16 +137,20 @@ public InputStatus pollNext(ReaderOutput<T> output) 
throws Exception {
                if (recordsWithSplitId == null) {
                        recordsWithSplitId = getNextFetch(output);
                        if (recordsWithSplitId == null) {
+                               idleSince = clock.absoluteTimeMillis();
                                return trace(finishedOrAvailableLater());
                        }
                }
+               // Reset the starting time for idleness.
+               idleSince = -1L;
 
                // we need to loop here, because we may have to go across splits
                while (true) {
                        // Process one record.
                        final E record = 
recordsWithSplitId.nextRecordFromSplit();
                        if (record != null) {
                                // emit the record.
+                               
context.metricGroup().getNumRecordsInCounter().inc();

Review comment:
       Can we have this as a field? Avoid the additional (virtual) method calls 
here?

##########
File path: 
flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/SourceReaderBase.java
##########
@@ -114,16 +137,20 @@ public InputStatus pollNext(ReaderOutput<T> output) 
throws Exception {
                if (recordsWithSplitId == null) {
                        recordsWithSplitId = getNextFetch(output);
                        if (recordsWithSplitId == null) {
+                               idleSince = clock.absoluteTimeMillis();

Review comment:
       For measuring intervals, relative time (which is stable) seems like a 
good choice. 




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


Reply via email to