yihua commented on code in PR #18484:
URL: https://github.com/apache/hudi/pull/18484#discussion_r3073234016
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/index/RocksDBIndexBackend.java:
##########
@@ -52,6 +61,41 @@ public void update(String recordKey,
HoodieRecordGlobalLocation recordGlobalLoca
this.rocksDBDAO.put(COLUMN_FAMILY, recordKey, recordGlobalLocation);
}
+ @Override
+ public void registerMetrics(MetricGroup metricGroup) {
+ if (rocksDBIndexMetrics != null) {
+ return;
+ }
+ this.rocksDBIndexMetrics = new FlinkRocksDBIndexMetrics(metricGroup, this);
+ this.rocksDBIndexMetrics.registerMetrics();
+ }
+
+ @VisibleForTesting
+ void flush() {
+ this.rocksDBDAO.flush();
+ }
+
+ public long getLongMetric(String property) {
+ try {
+ return this.rocksDBDAO.getLongProperty(property);
+ } catch (RocksDBException | RuntimeException e) {
+ log.debug("Failed to read RocksDB metric property {}", property, e);
+ return 0L;
+ }
+ }
+
+ public double getRatioMetric(TickerType hitTicker, TickerType missTicker) {
Review Comment:
🤖 The hit ratios here are computed from cumulative tickers since DB open, so
they reflect the all-time ratio rather than a recent window. For long-running
Flink jobs, this means the metric becomes very stable over time and won't
surface recent changes in cache behavior. Have you considered computing a
delta-based ratio (comparing ticker values between consecutive gauge polls) to
make the metric more responsive?
<sub><i>- Generated by an AI agent and may contain mistakes. Please verify
any suggestions before applying.</i></sub>
--
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]