luoyuxia commented on code in PR #2933:
URL: https://github.com/apache/fluss/pull/2933#discussion_r3007246967


##########
fluss-common/src/main/java/org/apache/fluss/metrics/MetricNames.java:
##########
@@ -280,4 +280,12 @@ public class MetricNames {
     public static final String NETTY_NUM_ALLOCATIONS_PER_SECONDS = 
"numAllocationsPerSecond";
     public static final String NETTY_NUM_HUGE_ALLOCATIONS_PER_SECONDS =
             "numHugeAllocationsPerSecond";
+
+    // 
--------------------------------------------------------------------------------------------
+    // metrics for tiering service
+    // 
--------------------------------------------------------------------------------------------
+
+    // for lake tiering metrics - operator level
+    public static final String TIERING_SERVICE_WRITTEN_BYTES = "writtenBytes";

Review Comment:
   This metric is for the lake bytes after written, I'm wondering  what metric 
name to use for the bytes before write?
   Atually, this metrics name make me feel it's for the bytes before write.



##########
fluss-common/src/main/java/org/apache/fluss/lake/writer/LakeWriter.java:
##########
@@ -47,4 +47,13 @@ public interface LakeWriter<WriteResult> extends Closeable {
      * @throws IOException if an I/O error occurs
      */
     WriteResult complete() throws IOException;
+
+    /**
+     * Returns the total bytes written to the lake storage in this write 
session. Computed from
+     * actual physical file sizes after {@link #complete()} is called. Returns 
-1 by default for
+     * backward compatibility with third-party implementations.
+     */
+    default long getBytesWritten() {

Review Comment:
   The method name suggests the raw data size written according to the Javadoc, 
but it actually returns the physical file size after compression and forma 
overhead. 
   This confuse me.. Maybe we can rename this method for better reflect the 
actual semantics. For example, getPersistedBytes or something else



##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/metrics/TieringMetrics.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.fluss.flink.tiering.source.metrics;
+
+import org.apache.fluss.annotation.Internal;
+import org.apache.fluss.metrics.MetricNames;
+
+import org.apache.flink.metrics.Counter;
+import org.apache.flink.metrics.MeterView;
+import org.apache.flink.metrics.MetricGroup;
+import org.apache.flink.metrics.groups.SourceReaderMetricGroup;
+
+/**
+ * A collection class for handling metrics in Tiering source reader.
+ *
+ * <p>All metrics are registered under group "fluss.tieringService", which is 
a child group of
+ * {@link org.apache.flink.metrics.groups.OperatorMetricGroup}.
+ *
+ * <p>The following metrics are available:
+ *
+ * <ul>
+ *   <li>{@code fluss.tieringService.writtenBytes} - Counter: cumulative bytes 
written to the lake
+ *       since the job started (physical file sizes).
+ *   <li>{@code fluss.tieringService.writtenBytesPerSecond} - Meter: write 
bytes-per-second rate
+ *       derived from the counter using a 60-second sliding window.
+ * </ul>
+ */
+@Internal
+public class TieringMetrics {
+
+    // Metric group names
+    public static final String FLUSS_METRIC_GROUP = "fluss";
+    public static final String TIERING_SERVICE_GROUP = "tieringService";
+
+    private final Counter writtenBytesCounter;
+
+    public TieringMetrics(SourceReaderMetricGroup sourceReaderMetricGroup) {

Review Comment:
   so, this metrics is reported to flink metric, right?  Is it same to flink 
cdc?



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