rdblue commented on code in PR #5268:
URL: https://github.com/apache/iceberg/pull/5268#discussion_r922336284


##########
api/src/main/java/org/apache/iceberg/metrics/ScanReporter.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.metrics;
+
+import java.util.Map;
+import org.apache.iceberg.metrics.ScanReport.ScanMetrics;
+
+/**
+ * This interface defines the basic API for a Table Scan Reporter that can be 
used to collect and report different
+ * metrics during a Table scan. The general usage of the Scan Reporter is as 
following:
+ * <ul>
+ *   <li>startScan() to indicate that this is a new Scan so that metrics (and 
other things) can be initialized</li>
+ *   <li>use scanMetrics() to add recorded metrics during a Scan</li>
+ *   <li>reportScan() at the end of the Scan</li>
+ * </ul>
+ */
+public interface ScanReporter {
+
+  /**
+   * Indicates that a new Scan is about to be performed, where implementors 
should initialize the {@link ScanMetrics},
+   * which can then be used to add recorded metrics to during a Scan.
+   */
+  void startScan();
+
+  /**
+   * Indicates that a Scan is done by reporting a {@link ScanReport}. A {@link 
ScanReport} is usually directly derived
+   * from a {@link ScanMetrics} instance.
+   *
+   * @param scanReport The {@link ScanReport} to report.
+   */
+  void reportScan(ScanReport scanReport);
+
+  /**
+   * The current {@link ScanMetrics} that can be used during a table scan to 
add metrics to.
+   *
+   * @return The current {@link ScanMetrics} that can be used during a table 
scan to add metrics to.
+   */
+  ScanMetrics scanMetrics();
+
+  /**
+   * Can be used to provide additional properties to the underlying {@link 
ScanReporter} implementation.
+   *
+   * @param properties The properties to pass to the underlying {@link 
ScanReporter} implementation.
+   */
+  void initialize(Map<String, String> properties);

Review Comment:
   I would probably remove customization for now. We can add this later.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to