Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions cgroup2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ var (
)

type Event struct {
Low uint64
High uint64
Max uint64
OOM uint64
OOMKill uint64
Low uint64
High uint64
Max uint64
OOM uint64
OOMKill uint64
OOMGroupKill uint64
}

// Resources for a cgroups v2 unified hierarchy
Expand Down Expand Up @@ -679,11 +680,12 @@ func readMemoryEvents(cgroupPath string) (*stats.MemoryEvents, error) {
return nil, nil
}
return &stats.MemoryEvents{
Low: memoryEvents["low"],
High: memoryEvents["high"],
Max: memoryEvents["max"],
Oom: memoryEvents["oom"],
OomKill: memoryEvents["oom_kill"],
Low: memoryEvents["low"],
High: memoryEvents["high"],
Max: memoryEvents["max"],
Oom: memoryEvents["oom"],
OomKill: memoryEvents["oom_kill"],
OomGroupKill: memoryEvents["oom_group_kill"],
}, nil
}

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

ec <- Event{
Low: out["low"],
High: out["high"],
Max: out["max"],
OOM: out["oom"],
OOMKill: out["oom_kill"],
Low: out["low"],
High: out["high"],
Max: out["max"],
OOM: out["oom"],
OOMKill: out["oom_kill"],
OOMGroupKill: out["oom_group_kill"],
}

if shouldExit {
Expand Down
21 changes: 16 additions & 5 deletions cgroup2/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
package cgroup2

type Memory struct {
Swap *int64
Min *int64
Max *int64
Low *int64
High *int64
Swap *int64
Min *int64
Max *int64
Low *int64
High *int64
OOMGroup *bool
}

func (r *Memory) Values() (o []Value) {
Expand Down Expand Up @@ -55,5 +56,15 @@ func (r *Memory) Values() (o []Value) {
value: *r.High,
})
}
if r.OOMGroup != nil {
var val int64
if *r.OOMGroup {
val = 1
}
o = append(o, Value{
filename: "memory.oom.group",
value: val,
})
}
return o
}
154 changes: 82 additions & 72 deletions cgroup2/stats/metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions cgroup2/stats/metrics.pb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,13 @@ file {
type: TYPE_UINT64
json_name: "oomKill"
}
field {
name: "oom_group_kill"
number: 6
label: LABEL_OPTIONAL
type: TYPE_UINT64
json_name: "oomGroupKill"
}
}
message_type {
name: "RdmaStat"
Expand Down
1 change: 1 addition & 0 deletions cgroup2/stats/metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ message MemoryEvents {
uint64 max = 3;
uint64 oom = 4;
uint64 oom_kill = 5;
uint64 oom_group_kill = 6;
}

message RdmaStat {
Expand Down
Loading