zqr10159 opened a new pull request, #3883: URL: https://github.com/apache/hertzbeat/pull/3883
This pull request introduces DuckDB as a new backend for historical metrics data storage in Hertzbeat, replacing the previous JPA-based configuration. It updates configuration files, adds the necessary JDBC dependency, and implements the core data storage logic for DuckDB. The changes also include code and configuration cleanups related to this transition. **DuckDB Integration and Configuration:** * Added DuckDB as a supported history data store in configuration files (`application.yml` and `application-test.yml`), replacing the previous JPA configuration and extending the default data retention period from 1 hour to 90 days. (`[[1]](diffhunk://#diff-fbbd6cb1f62c63b9c263c9df8c2234f065b8df92bac40f984138d1f050333ed1L172-R175)`, `[[2]](diffhunk://#diff-1a8a62c80dcfb014038e390768592d27cb8e38ff2e10f8fc3e6a7caebcca74e0L58-R60)`) * Added DuckDB JDBC dependency to `hertzbeat-warehouse/pom.xml` to enable Java-based storage and querying of metrics data. (`[hertzbeat-warehouse/pom.xmlR147-R151](diffhunk://#diff-213734eecc428371acd512a382769c79b04d2ad92cf2700c83892ec4d3d0463dR147-R151)`) * Implemented the main DuckDB data storage logic in the new class `DuckdbDatabaseDataStorage`, including methods for saving, querying, and aggregating historical metric data, as well as scheduled cleanup of expired records. (`[hertzbeat-warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tsdb/duckdb/DuckdbDatabaseDataStorage.javaR1-R390](diffhunk://#diff-e40d3486f7f0c1c34c71e187d145d650c89e93f2f780b871488a506199535ae8R1-R390)`) * Added a constant for DuckDB in the `HistoryName` interface to support identification and configuration of the new backend. (`[hertzbeat-warehouse/src/main/java/org/apache/hertzbeat/warehouse/constants/WarehouseConstants.javaR49-R50](diffhunk://#diff-13a3b2be2768d54ccb23b8d45040ee74f86c6151b073909ae2f0d6411639ad80R49-R50)`) * Renamed and refactored the properties class from `JpaProperties` to `DuckdbProperties`, updating its package and references to reflect the new backend. (`[hertzbeat-warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tsdb/duckdb/DuckdbProperties.javaL18-R18](diffhunk://#diff-065505f8de273e75e9a6b534fa1e4f317df0d289a42e6a6e277d1b9ddf8c3b4bL18-R18)`) **Codebase Cleanup:** * Removed legacy and redundant comments from `hertzbeat-warehouse/pom.xml` for better readability and maintainability. (`[[1]](diffhunk://#diff-213734eecc428371acd512a382769c79b04d2ad92cf2700c83892ec4d3d0463dL32-L49)`, `[[2]](diffhunk://#diff-213734eecc428371acd512a382769c79b04d2ad92cf2700c83892ec4d3d0463dL64-L70)`, `[[3]](diffhunk://#diff-213734eecc428371acd512a382769c79b04d2ad92cf2700c83892ec4d3d0463dL86-L98)`, `[[4]](diffhunk://#diff-213734eecc428371acd512a382769c79b04d2ad92cf2700c83892ec4d3d0463dL122)`, `[[5]](diffhunk://#diff-213734eecc428371acd512a382769c79b04d2ad92cf2700c83892ec4d3d0463dL133-L139)`) These changes collectively enable DuckDB as a high-performance, embedded storage solution for historical metrics, improving retention and simplifying deployment. <img width="1920" height="917" alt="image" src="https://github.com/user-attachments/assets/52011149-c811-4c14-8ef3-dd3db88cc34f" /> -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
