Skip to content

Conversation

@dcantah
Copy link
Member

@dcantah dcantah commented Jan 12, 2026

A large user of this library (unsurprisingly) is the containerd daemon, and specifically through the CRI entrypoint. There's quite a few stats we gather that are never bubbled up the chain when requested through that funnel. The stats never used are:

MemoryEvents, Rdma, Hugetlb, and IO.

We should likely do the same to cg1 (#370), but if we want to add it to the Cgroup interface it'd be a breaking change.

cpu: AMD Ryzen 9 9950X3D 16-Core Processor

BenchmarkStatFiltered/StatAll-32                    5547            619802 ns/op           48778 B/op        316 allocs/op
BenchmarkStatFiltered/CPUOnly-32                   59121             60774 ns/op           10032 B/op         43 allocs/op
BenchmarkStatFiltered/MemoryOnly-32                16192            222286 ns/op           15552 B/op        158 allocs/op
BenchmarkStatFiltered/CPUAndMemory-32              12670            286484 ns/op           25440 B/op        200 allocs/op

A large user of this library (unsurprisingly) is the containerd
daemon, and specifically through the CRI entrypoint. There's quite
a few stats we gather that are never bubbled up the chain when requested
through that funnel. The stats never used are:

MemoryEvents, Rdma, Hugetlb, and IO.

We should likely do the same to cg1, but if we want to add it to the Cgroup
interface it'd be a breaking change.

Signed-off-by: Danny Canter <[email protected]>
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

metrics.MemoryEvents, err = readMemoryEvents(c.path)
if err != nil {
return nil, err
if mask&StatMemoryEvents != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea. I was thinking adding new function to cgroupv2 object to get event information.
This solution looks good!

Copy link
Member Author

@dcantah dcantah Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually went down this rabbit hole because I wanted a way to solely just get the memory events also.. But this seemed a little bit easier to digest than a new method that solely returned those 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants