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:
   
![sem-filtro](https://user-images.githubusercontent.com/17031007/153494826-53ab79c3-ce3e-4a8f-81cb-3b9455ee3219.png)
   
   - Filtering by start and end date:
   ![com 
filtro](https://user-images.githubusercontent.com/17031007/153494851-ec11d7a9-9dcb-4650-b3f5-e692a5d5412b.png)
   
   #### UI changes
   - Metrics disabled. It shows all VMs:
   
![0](https://user-images.githubusercontent.com/17031007/153494239-cb222fae-39a3-40fd-946d-252e5b4c84a0.png)
   
   - Metrics enabled. It shows only running VMs and their current stats:
   
![1](https://user-images.githubusercontent.com/17031007/153494273-f140062c-f575-4c78-8c1e-c3c17d84bf7c.png)
   
   - Metrics enabled and filtering by stopped VMs. It forces the display of 
stopped VMs and their latest stats collected (not reflecting their current 
stats):
   
![2](https://user-images.githubusercontent.com/17031007/153494291-ff762ee1-73d2-47e0-a77d-de2bcdab3154.png)
   
   ### 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]


Reply via email to