joseflauzino opened a new pull request #5984: URL: https://github.com/apache/cloudstack/pull/5984
### Description This PR addresses issue #5935. In summary, this PR makes ACS persist VM stats in the database to provide more consistency and make it possible to obtain historical data. For more information, please refer to the spec contained in issue #5935. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [X] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [X] Major - [ ] Minor ### Screenshots #### New API - Getting all available stats:  - Filtering by start and end date:  #### UI changes - Metrics disabled. It shows all VMs:  - Metrics enabled. It shows only running VMs and their current stats:  - Metrics enabled and filtering by stopped VMs. It forces the display of stopped VMs and their latest stats collected (not reflecting their current stats):  ### How Has This Been Tested? I added unit tests to several methods. Also, in a local lab, I performed the following tests: - I tested different combinations of the global settings `vm.stats.increment.metrics`, `vm.stats.max.retention.time`, and `vm.stats.interval`. All tests resulted in the expected behavior, as described in section [2.2](https://github.com/apache/cloudstack/issues/5935#2-proposed-changes--22-configuration-proposal) of the spec. - I tested the listVirtualMachinesMetrics API with different combinations of its new `accumulate` parameter with the global configuration `vm.stats.increment.metrics`, and everything worked as expected. See sections [2.2](https://github.com/apache/cloudstack/issues/5935#2-proposed-changes--22-configuration-proposal) and [3.3](https://github.com/apache/cloudstack/issues/5935#3-work-items--33-api) of the spec for more details. - I tested the UI modifications mentioned in section [3.4](https://github.com/apache/cloudstack/issues/5935#3-work-items--34-ui) of the spec. The obtained behavior was as follows: - When clicking on the "Metrics" button only running VMs and their respective stats were listed; - Then it was possible to "force" the listing of stopped VMs by changing the filter from "All" to "Stopped". - I tested the new listVirtualMachinesUsageHistory API by filtering by different time periods and VMs. All the filtering described in section [2.4](https://github.com/apache/cloudstack/issues/5935#2-proposed-changes--24-new-api-proposal) of the spec was successfully tested. -- 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]
