zqr10159 opened a new pull request, #3989: URL: https://github.com/apache/hertzbeat/pull/3989
This pull request updates the way query parameters are constructed and encoded in the `VictoriaMetricsClusterDataStorage` class to ensure compatibility and correctness when interacting with the VictoriaMetrics API. The changes focus on properly encoding parameter names and values, updating how time ranges are specified, and fixing the construction of endpoint URLs. **Improvements to query parameter encoding and URL construction:** * Changed all query parameter additions in API calls to use `URLEncoder.encode` for both parameter names (e.g., `"query"`, `"match[]"`) and values, ensuring correct encoding for VictoriaMetrics endpoints. [[1]](diffhunk://#diff-c2a46db311401c66fd1101143ebe4100c85dbe12f169f4d552c53340b4401939L313-R316) [[2]](diffhunk://#diff-c2a46db311401c66fd1101143ebe4100c85dbe12f169f4d552c53340b4401939L415-R413) [[3]](diffhunk://#diff-c2a46db311401c66fd1101143ebe4100c85dbe12f169f4d552c53340b4401939L458-R454) [[4]](diffhunk://#diff-c2a46db311401c66fd1101143ebe4100c85dbe12f169f4d552c53340b4401939L497-R493) [[5]](diffhunk://#diff-c2a46db311401c66fd1101143ebe4100c85dbe12f169f4d552c53340b4401939L536-R532) * Updated the construction of the `rangeUrl` by prepending the cluster base URL, fixing a potential issue with incomplete endpoint paths. **Improvements to time range specification:** * Refactored the calculation and formatting of `start` and `end` time parameters in the `getHistoryMetricData` method to use relative time strings (e.g., `"now-1h"`) instead of epoch seconds, aligning with VictoriaMetrics API expectations. **Minor cleanup:** * Removed unused import of `Instant` from the class. -- 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]
