You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Solution
Docker provides this information in the stats command. The proposed solution is to expose this information from the Container interface as Container.Stats()
The raw information obtained from docker is quite extensive as seen in the example below, with many elements only available in Linux systems but not in Windows. Moreover, the units used for the reported metrics can vary between platforms. For example, Linux uses nanoseconds for measuring CPU time, while Windows uses 100s of nanoseconds.
container's stats in JSON format. Click to visualize
Therefore, we suggest returning a custom type with the information provided by the stats command and containing only fields that are available in both Linux and Windows platforms and normalized to one unit (for example, nanoseconds):
typeContainerStatsstruct {
Timestamp time.TimeCPUUsageTotaluint64CPUUsageInKerneluint64CPUUsageUseruint64CPUPercentagefloat64MemoryUsageuint64// in Windows, it corresponds to Commit memoryMemoryMaxUsageuint64// in Windows, it corresponds to PeakCommit memoryMemoryPercentagefloat64NetworkRxBytesuint64NetworkTxBytesuint64BlockIOReadBytesuint64// BlockIO metrics must be calculated from different sources in Windows and LinuxBlockIOWriteBytesuint64
}
Benefit
Offers the ability to monitor a container's resource usage.
Alternatives
We don't see any alternative that is convenient for the test developer.
Would you like to help contributing this feature?
Yes
The text was updated successfully, but these errors were encountered:
Problem
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.
Solution
Docker provides this information in the
stats
command. The proposed solution is to expose this information from theContainer
interface asContainer.Stats()
The raw information obtained from docker is quite extensive as seen in the example below, with many elements only available in Linux systems but not in Windows. Moreover, the units used for the reported metrics can vary between platforms. For example, Linux uses
nanoseconds
for measuringCPU
time, while Windows uses100s
ofnanoseconds
.container's stats in JSON format. Click to visualize
Therefore, we suggest returning a custom type with the information provided by the
stats
command and containing only fields that are available in both Linux and Windows platforms and normalized to one unit (for example, nanoseconds):Benefit
Offers the ability to monitor a container's resource usage.
Alternatives
We don't see any alternative that is convenient for the test developer.
Would you like to help contributing this feature?
Yes
The text was updated successfully, but these errors were encountered: