Report memory stats using the same logic that docker uses for stats output; avoid extreme differences in output

This commit is contained in:
Dane Everitt
2020-05-08 22:06:26 -07:00
parent a6645aa741
commit 483b652087
2 changed files with 27 additions and 4 deletions

View File

@@ -501,7 +501,7 @@ func (d *DockerEnvironment) EnableResourcePolling() error {
}
s.Resources.CpuAbsolute = s.Resources.CalculateAbsoluteCpu(&v.PreCPUStats, &v.CPUStats)
s.Resources.Memory = v.MemoryStats.Usage
s.Resources.Memory = s.Resources.CalculateDockerMemory(v.MemoryStats)
s.Resources.MemoryLimit = v.MemoryStats.Limit
// Why you ask? This already has the logic for caching disk space in use and then
@@ -827,7 +827,6 @@ func (d *DockerEnvironment) exposedPorts() nat.PortSet {
return out
}
// Formats the resources available to a server instance in such as way that Docker will
// generate a matching environment in the container.
//