schnappi17 commented on code in PR #1638:
URL: https://github.com/apache/incubator-paimon/pull/1638#discussion_r1284338522


##########
paimon-core/src/main/java/org/apache/paimon/metrics/commit/CommitMetrics.java:
##########
@@ -0,0 +1,180 @@
+/*
+ * 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.paimon.metrics.commit;
+
+import org.apache.paimon.annotation.VisibleForTesting;
+import org.apache.paimon.metrics.Counter;
+import org.apache.paimon.metrics.DescriptiveStatisticsHistogram;
+import org.apache.paimon.metrics.Histogram;
+import org.apache.paimon.metrics.MetricGroup;
+import org.apache.paimon.metrics.groups.GenericMetricGroup;
+import org.apache.paimon.utils.FileStorePathFactory;
+
+/** Metrics to measure a commit. */
+public class CommitMetrics {
+    private static final int HISTOGRAM_WINDOW_SIZE = 10_000;
+    protected static final String GROUP_NAME = "commit";
+
+    private final MetricGroup genericMetricGroup;
+    private final FileStorePathFactory pathFactory;
+
+    public CommitMetrics(FileStorePathFactory pathFactory) {
+        this.pathFactory = pathFactory;
+        this.genericMetricGroup =
+                GenericMetricGroup.createGenericMetricGroup(
+                        pathFactory.root().getName(), GROUP_NAME);
+        registerGenericCommitMetrics();
+    }
+
+    public MetricGroup getGenericMetricGroup() {
+        return genericMetricGroup;
+    }
+
+    private final Histogram durationHistogram =
+            new DescriptiveStatisticsHistogram(HISTOGRAM_WINDOW_SIZE);
+
+    private CommitStats latestCommit;
+
+    @VisibleForTesting static final String LAST_COMMIT_DURATION = 
"lastCommitDuration";
+    @VisibleForTesting static final String COMMIT_DURATION = "commitDuration";
+    @VisibleForTesting static final String LAST_COMMIT_ATTEMPTS = 
"lastCommitAttempts";
+    @VisibleForTesting static final String LAST_TABLE_FILES_ADDED = 
"lastTableFilesAdded";
+    @VisibleForTesting static final String LAST_TABLE_FILES_DELETED = 
"lastTableFilesDeleted";
+    @VisibleForTesting static final String LAST_TABLE_FILES_APPENDED = 
"lastTableFilesAppended";
+
+    @VisibleForTesting
+    static final String LAST_TABLE_FILES_COMMIT_COMPACTED = 
"lastTableFilesCommitCompacted";

Review Comment:
   I want to distinguish the commit metrics with the compact metrics, for there 
are some number of files metrics is related to compactions in commit operation.



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