shangxinli opened a new pull request, #19108: URL: https://github.com/apache/hudi/pull/19108
### Change Logs Adds `HoodieMetrics#emitTableVersionMetric(int)` which registers a `table.tableVersion` gauge in the metrics registry. `BaseHoodieClient` calls it once per client construction after loading the table's metaClient. ### Motivation The existing metrics surface does not expose the on-disk Hudi table version at all. Operators upgrading across major Hudi versions — particularly anyone running with `hoodie.write.auto.upgrade=false` and a pinned `hoodie.write.table.version` — currently have no observability signal to alert when a table is unexpectedly promoted to a newer table version by an upgrade path. This change fills the gap with a single one-shot gauge that fires on every write / table-service client init, so standard alerting (Prometheus / Datadog / Graphite / JMX) can flag the drift in near real time. ### Behavior - Gauge name: `<metric.prefix>.<tableName>.table.tableVersion` - Value: integer `HoodieTableVersion#versionCode()` (e.g. `6`, `8`) - Emitted at the end of `BaseHoodieClient` construction, once. - **Best-effort:** if the table has not yet been initialized (first-ever write to a new base path) the metaClient load throws and we log at DEBUG and skip; the gauge will surface on the next client init after the table exists. - No-op when metrics are disabled (`config.isMetricsOn() == false`). ### Impact Pure additive change. No on-disk state, no schema change, no behavior change for tables that disable metrics. Existing callers unaffected. ### Risk level: **none** ### Documentation Update None — this is an additive metric exposed through the existing reporter infrastructure. ### Contributor's checklist - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Change Logs and Impact were stated clearly - [x] Adequate tests were added if applicable - [x] CI passed -- 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]
