Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR is a proof of concept for gathering resource consumption stats for a container.
Open Issues:
Container
interface would break other implementations of the interface such as thereaperContainer
1s
.One alternative implementation could be passing the previous sample to the stats call. If it is nil, the instantaneous stats will be returned (with the CPU% as 0)
Testing the new feature is challenging. A container's resource consumption varies depending on many factors. Therefore, the statistics retrieved from a container cannot just be compared with an expected value.
This code has not yet been tested for Windows
Why is it important?
In some use cases, it would be convenient to have access to the container's stats to measure the resource (memory, CPU) consumption to detect regressions or establish a comparison between alternative implementations or configurations.
Related issues
How to test this PR
In its current form, the suggested way to test is by looking at the CPU stats and see if vales are "reasonable" .
Automating tests is an ongoing effort.
Follow-ups