summaryrefslogtreecommitdiff
path: root/daemon/daemon_unix.go
diff options
context:
space:
mode:
authorAkihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>2020-07-24 21:06:29 +0900
committerAkihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>2020-07-30 14:31:20 +0900
commit51e3cd47617834165faf28c8b5a771811fbf8f28 (patch)
tree4e7c90c42c6afda774867cb7e1f7c2adfcacfe7d /daemon/daemon_unix.go
parent0592aac95c0d1dce1686281bc4fab09de47686b5 (diff)
downloaddocker-51e3cd47617834165faf28c8b5a771811fbf8f28.tar.gz
statsV2: implement Failcnt
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Diffstat (limited to 'daemon/daemon_unix.go')
-rw-r--r--daemon/daemon_unix.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go
index 1657fcbfab..d13774fe1a 100644
--- a/daemon/daemon_unix.go
+++ b/daemon/daemon_unix.go
@@ -1566,12 +1566,16 @@ func (daemon *Daemon) statsV2(s *types.StatsJSON, stats *statsV2.Metrics) (*type
Usage: stats.Memory.Usage,
// MaxUsage is not supported
Limit: stats.Memory.UsageLimit,
- // TODO: Failcnt
}
// if the container does not set memory limit, use the machineMemory
if s.MemoryStats.Limit > daemon.machineMemory && daemon.machineMemory > 0 {
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 {