majian1998 commented on code in PR #10010:
URL: https://github.com/apache/hudi/pull/10010#discussion_r1386042124


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metrics/MetricsFileSystemReporter.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * 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.hudi.metrics;
+
+import org.apache.hudi.common.config.SerializableConfiguration;
+import org.apache.hudi.common.fs.FSUtils;
+import org.apache.hudi.common.util.JsonUtils;
+import org.apache.hudi.common.util.StringUtils;
+import org.apache.hudi.config.HoodieWriteConfig;
+
+import com.codahale.metrics.MetricRegistry;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+public class MetricsFileSystemReporter extends MetricsReporter {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MetricsFileSystemReporter.class);
+  private MetricRegistry metricRegistry;
+  private SerializableConfiguration hadoopConf;
+  private String metricsPath;
+  private HoodieWriteConfig config;
+  private FileSystem fs;
+  private ScheduledExecutorService executor;
+  private static final String META_FOLDER_NAME = "/.hoodie";
+  private static final String METRICS_FOLDER_NAME = "/metrics";
+  private static final String METRICS_FILE_NAME = "_metrics.json";

Review Comment:
   Currently, the issue of storing multiple versions of results has been 
considered, and an overwrite parameter has been reserved to control this. The 
initial idea is to add a timestamp + cleanup strategy. However, this would be 
quite complex, so it has been temporarily placed in the TODO list, and the 
feasibility of the file system reporter needs to be confirmed first.
   Regarding the current way of overwriting files, by default, the data will be 
written under the ".hoodie" directory of the table and only one file will be 
kept, so there will be no conflicts with tables of the same name. Additionally, 
the file name prefix is designed to handle the overwriting of results in 
different functionalities or table scenarios. There is certainly room for 
optimization in this aspect.



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

Reply via email to