prashantwason opened a new pull request, #17466:
URL: https://github.com/apache/hudi/pull/17466

   ### Describe the issue this Pull Request addresses
   
   Closes #HUDI-5724
   
   This PR ports the HoodieVersion class and the commit that publishes the 
major, minor, and patch version of HUDI as integers via the metric system. 
These metrics can be used to track the versions of HUDI running in production.
   
   ### Summary and Changelog
   
   **Summary:**
   - Added `HoodieVersion` class that provides semantic versioning information 
for HUDI code
   - Added version metrics (major, minor, patch) as integers to the metrics 
system
   - These metrics complement the existing version string already added to 
commit instants
   
   **Changelog:**
   1. **New HoodieVersion class** 
(hudi-common/src/main/java/org/apache/hudi/HoodieVersion.java):
      - Provides methods to get complete version string: `get()`
      - Provides semantic version components: `major()`, `minor()`, `patch()`
      - Provides integer versions for metrics: `majorAsInt()`, `minorAsInt()`, 
`patchAsInt()`
      - Handles various version formats including snapshots and suffixes
   
   2. **New TestHoodieVersion test class** 
(hudi-common/src/test/java/org/apache/hudi/TestHoodieVersion.java):
      - Comprehensive unit tests for HoodieVersion functionality
      - Tests version parsing with various formats (0.12.2, 0.12.2-spark3, etc.)
      - Tests integer conversion handling edge cases
   
   3. **Updated BaseHoodieWriteClient** 
(hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java):
      - Added import for HoodieVersion
      - Added metrics registration for version.major, version.minor, 
version.patch as integer gauges
      - Updated existing version metric to use HoodieVersion.get()
   
   ### Impact
   
   **Public API Changes:** None - This is additive only
   
   **User-Facing Changes:**
   - New metrics available: `version.major`, `version.minor`, `version.patch` 
(as integers)
   - Existing version metric now uses HoodieVersion class instead of package 
implementation version
   
   **Performance Impact:** Negligible - metrics are registered once during 
client initialization
   
   ### Risk Level
   
   **Low**
   
   The changes are additive and do not modify existing behavior. The 
HoodieVersion class is straightforward with comprehensive unit tests. Metrics 
registration happens during client initialization and has minimal overhead.
   
   Verification:
   - Unit tests added for HoodieVersion class covering various version formats
   - Existing metrics system integration tested
   - No breaking changes to existing APIs
   
   ### Documentation Update
   
   None required. This is an internal metrics improvement. The version 
information is already documented as part of commit metadata.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable


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