Skip to content

Commit 550e84d

Browse files
committed
Events: Add OOMGroupKill
Closes #274 Signed-off-by: Danny Canter <danny@dcantah.dev>
1 parent 568b349 commit 550e84d

5 files changed

Lines changed: 114 additions & 91 deletions

File tree

cgroup1/stats/metrics.pb.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cgroup2/manager.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ var (
5959
)
6060

6161
type Event struct {
62-
Low uint64
63-
High uint64
64-
Max uint64
65-
OOM uint64
66-
OOMKill uint64
62+
Low uint64
63+
High uint64
64+
Max uint64
65+
OOM uint64
66+
OOMKill uint64
67+
OOMGroupKill uint64
6768
}
6869

6970
// Resources for a cgroups v2 unified hierarchy
@@ -679,11 +680,12 @@ func readMemoryEvents(cgroupPath string) (*stats.MemoryEvents, error) {
679680
return nil, nil
680681
}
681682
return &stats.MemoryEvents{
682-
Low: memoryEvents["low"],
683-
High: memoryEvents["high"],
684-
Max: memoryEvents["max"],
685-
Oom: memoryEvents["oom"],
686-
OomKill: memoryEvents["oom_kill"],
683+
Low: memoryEvents["low"],
684+
High: memoryEvents["high"],
685+
Max: memoryEvents["max"],
686+
Oom: memoryEvents["oom"],
687+
OomKill: memoryEvents["oom_kill"],
688+
OomGroupKill: memoryEvents["oom_group_kill"],
687689
}, nil
688690
}
689691

@@ -837,11 +839,12 @@ func (c *Manager) EventChan() (<-chan Event, <-chan error) {
837839
}
838840

839841
ec <- Event{
840-
Low: out["low"],
841-
High: out["high"],
842-
Max: out["max"],
843-
OOM: out["oom"],
844-
OOMKill: out["oom_kill"],
842+
Low: out["low"],
843+
High: out["high"],
844+
Max: out["max"],
845+
OOM: out["oom"],
846+
OOMKill: out["oom_kill"],
847+
OOMGroupKill: out["oom_group_kill"],
845848
}
846849

847850
if shouldExit {

cgroup2/stats/metrics.pb.go

Lines changed: 85 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cgroup2/stats/metrics.pb.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,13 @@ file {
509509
type: TYPE_UINT64
510510
json_name: "oomKill"
511511
}
512+
field {
513+
name: "oom_group_kill"
514+
number: 6
515+
label: LABEL_OPTIONAL
516+
type: TYPE_UINT64
517+
json_name: "oomGroupKill"
518+
}
512519
}
513520
message_type {
514521
name: "RdmaStat"

cgroup2/stats/metrics.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ message MemoryEvents {
9191
uint64 max = 3;
9292
uint64 oom = 4;
9393
uint64 oom_kill = 5;
94+
uint64 oom_group_kill = 6;
9495
}
9596

9697
message RdmaStat {

0 commit comments

Comments
 (0)