stevenzwu commented on code in PR #9524: URL: https://github.com/apache/iceberg/pull/9524#discussion_r1460717138
########## flink/v1.18/flink/src/main/java/org/apache/iceberg/flink/source/assigner/SplitAssigner.java: ########## @@ -115,4 +115,7 @@ default void onCompletedSplits(Collection<String> completedSplitIds) {} * snapshots and splits, which defeats the purpose of throttling. */ int pendingSplitCount(); + + /** Pending records count */ Review Comment: I won't worry too much. the `estimated` part comes from a split large file. there is no record count for each split/chunk. hence the record count is estimated based on ratio of the split bytes / file bytes. ########## flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/source/TestIcebergSourceContinuous.java: ########## @@ -367,6 +382,8 @@ public void testSpecificSnapshotTimestamp() throws Exception { List<Row> result3 = waitForResult(iter, 2); TestHelpers.assertRecords(result3, batch3, tableResource.table().schema()); + + assertThatIcebergEnumeratorMetricsExist(); Review Comment: I guess it is probably difficult to reliably assert on the values of `unassginedSplits` and `pendingRecords` due to timing, unless we can add a listener to the metric reporter to track all value changes for a metric. ########## flink/v1.18/flink/src/main/java/org/apache/iceberg/flink/ElapsedTimeGauge.java: ########## @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.iceberg.flink; + +import java.util.concurrent.TimeUnit; +import org.apache.flink.annotation.Internal; +import org.apache.flink.metrics.Gauge; + +/** + * This gauge measures the elapsed time between now and last recorded time set by {@link + * ElapsedTimeGauge#refreshLastRecordedTime()}. + */ +@Internal +public class ElapsedTimeGauge implements Gauge<Long> { Review Comment: nit: maybe move to `util` package? ########## flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/source/TestIcebergSourceContinuous.java: ########## @@ -418,4 +435,21 @@ public static List<JobID> getRunningJobs(ClusterClient<?> client) throws Excepti .map(JobStatusMessage::getJobId) .collect(Collectors.toList()); } + + private static void assertThatIcebergEnumeratorMetricsExist() { + assertThatIcebergSourceMetricExists( + "enumerator", "coordinator.enumerator.elapsedSecondsSinceLastSplitDiscovery"); + assertThatIcebergSourceMetricExists("enumerator", "coordinator.enumerator.unassignedSplits"); Review Comment: what about `pendingRecords`? ########## flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/MiniClusterResource.java: ########## @@ -50,4 +51,18 @@ public static MiniClusterWithClientResource createWithClassloaderCheckDisabled() .setConfiguration(DISABLE_CLASSLOADER_CHECK_CONFIG) .build()); } + + public static MiniClusterWithClientResource createWithClassloaderCheckDisabled( Review Comment: in this case, there is no new test class added. maybe junit5 should be handled separately? -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org