Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
| ... | ... |
@@ -1566,12 +1566,16 @@ func (daemon *Daemon) statsV2(s *types.StatsJSON, stats *statsV2.Metrics) (*type |
| 1566 | 1566 |
Usage: stats.Memory.Usage, |
| 1567 | 1567 |
// MaxUsage is not supported |
| 1568 | 1568 |
Limit: stats.Memory.UsageLimit, |
| 1569 |
- // TODO: Failcnt |
|
| 1570 | 1569 |
} |
| 1571 | 1570 |
// if the container does not set memory limit, use the machineMemory |
| 1572 | 1571 |
if s.MemoryStats.Limit > daemon.machineMemory && daemon.machineMemory > 0 {
|
| 1573 | 1572 |
s.MemoryStats.Limit = daemon.machineMemory |
| 1574 | 1573 |
} |
| 1574 |
+ if stats.MemoryEvents != nil {
|
|
| 1575 |
+ // Failcnt is set to the "oom" field of the "memory.events" file. |
|
| 1576 |
+ // See https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html |
|
| 1577 |
+ s.MemoryStats.Failcnt = stats.MemoryEvents.Oom |
|
| 1578 |
+ } |
|
| 1575 | 1579 |
} |
| 1576 | 1580 |
|
| 1577 | 1581 |
if stats.Pids != nil {
|