mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
statsV2: implement Failcnt
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
0592aac95c
commit
51e3cd4761
1 changed files with 5 additions and 1 deletions
|
@ -1566,12 +1566,16 @@ func (daemon *Daemon) statsV2(s *types.StatsJSON, stats *statsV2.Metrics) (*type
|
||||||
Usage: stats.Memory.Usage,
|
Usage: stats.Memory.Usage,
|
||||||
// MaxUsage is not supported
|
// MaxUsage is not supported
|
||||||
Limit: stats.Memory.UsageLimit,
|
Limit: stats.Memory.UsageLimit,
|
||||||
// TODO: Failcnt
|
|
||||||
}
|
}
|
||||||
// if the container does not set memory limit, use the machineMemory
|
// if the container does not set memory limit, use the machineMemory
|
||||||
if s.MemoryStats.Limit > daemon.machineMemory && daemon.machineMemory > 0 {
|
if s.MemoryStats.Limit > daemon.machineMemory && daemon.machineMemory > 0 {
|
||||||
s.MemoryStats.Limit = daemon.machineMemory
|
s.MemoryStats.Limit = daemon.machineMemory
|
||||||
}
|
}
|
||||||
|
if stats.MemoryEvents != nil {
|
||||||
|
// Failcnt is set to the "oom" field of the "memory.events" file.
|
||||||
|
// See https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html
|
||||||
|
s.MemoryStats.Failcnt = stats.MemoryEvents.Oom
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if stats.Pids != nil {
|
if stats.Pids != nil {
|
||||||
|
|
Loading…
Reference in a new issue