Zakelly commented on code in PR #25884:
URL: https://github.com/apache/flink/pull/25884#discussion_r1908112421


##########
docs/content.zh/docs/ops/metrics.md:
##########
@@ -1536,6 +1536,41 @@ Note that for failed checkpoints, metrics are updated on 
a best efforts basis an
 ### RocksDB
 Certain RocksDB native metrics are available but disabled by default, you can 
find full documentation [here]({{< ref "docs/deployment/config" 
>}}#rocksdb-native-metrics)
 
+### ForStDB
+<table class="table table-bordered">
+  <thead>
+    <tr>
+      <th class="text-left" style="width: 18%">Scope</th>
+      <th class="text-left" style="width: 26%">Metrics</th>
+      <th class="text-left" style="width: 48%">Description</th>
+      <th class="text-left" style="width: 8%">Type</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <th rowspan="4"><strong>Task/Operator</strong></th>
+      <td>forst.fileCache.hit</td>
+      <td>The hit count of ForSt state backend cache.</td>
+      <td>Counter</td>
+    </tr>
+    <tr>
+      <td>forst.fileCache.miss</td>
+      <td>The miss count of ForSt state backend cache.</td>
+      <td>Counter</td>
+    </tr>
+    <tr>
+      <td>forst.fileCache.usedBytes</td>
+      <td>The bytes cached in ForSt state backend cache.</td>
+      <td>Gauge</td>
+    </tr>
+    <tr>
+      <td>forst.fileCache.remainingBytes</td>
+      <td>The free bytes remaining in ForSt state backend cache. Only 
available when space based cache is enabled. </td>

Review Comment:
   ```suggestion
         <td>The remaining space in the volumn for the configured cache. Only 
available when 'state.backend.forst.cache.reserve-size' is set above 0. </td>
   ```



##########
flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/fs/cache/BundledCacheLimitPolicy.java:
##########
@@ -54,6 +56,17 @@ public void release(long toReleaseSize) {
         policies.forEach(policy -> policy.release(toReleaseSize));
     }
 
+    @Override
+    public long usedBytes() {
+        return 
policies.stream().mapToLong(CacheLimitPolicy::usedBytes).max().getAsLong();
+    }
+
+    @Override
+    public void registerCustomizedMetrics(String prefix, MetricGroup 
metricGroup) {
+        metricGroup.gauge(prefix + ".usedBytes", () -> usedBytes());

Review Comment:
   If the `BundledCacheLimitPolicy` is not enabled (only single policy is 
enabled), then how does this gauge report?



-- 
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...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to