Skip to content

Conversation

@jesseward
Copy link

Summary

This adds a new constructor NewFromNow that moves the /dev/kmsg reader offset to the end of the queue. Allowing the user to ignore OOM events that occurred prior to the creation of the OomParser object.

Examples

Create stream using New (default behaviour)

Returns all available OOM events in the kmsg buffer. This is the default behaviour and is not changed.

$ sudo go run oomexample/main.go 
I0727 20:31:50.742685 1989715 main.go:48] Reading the buffer. Output is &{393038 stress-ng-vm 2025-07-25 23:11:27.182087673 +0000 UTC m=-163223.536149722 /system.slice/docker-4876bd1d7f860bacc8df1c342f058bb861c41a328a1cce0b753eae6f0849b241.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-podd993a249_6fb5_48dc_90fe_5c176fa43a7f.slice/cri-containerd-85a888cadb58adab390959abaa0db3996a9997193d137ed321dcf0e0b56c680b.scope /system.slice/docker-4876bd1d7f860bacc8df1c342f058bb861c41a328a1cce0b753eae6f0849b241.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-podd993a249_6fb5_48dc_90fe_5c176fa43a7f.slice CONSTRAINT_MEMCG}
I0727 20:31:50.743393 1989715 main.go:48] Reading the buffer. Output is &{393053 stress-ng-vm 2025-07-25 23:11:27.910033673 +0000 UTC m=-163222.808203722 /system.slice/docker-4876bd1d7f860bacc8df1c342f058bb861c41a328a1cce0b753eae6f0849b241.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-podd993a249_6fb5_48dc_90fe_5c176fa43a7f.slice/cri-containerd-85a888cadb58adab390959abaa0db3996a9997193d137ed321dcf0e0b56c680b.scope /system.slice/docker-4876bd1d7f860bacc8df1c342f058bb861c41a328a1cce0b753eae6f0849b241.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-podd993a249_6fb5_48dc_90fe_5c176fa43a7f.slice CONSTRAINT_MEMCG}
I0727 20:31:50.744026 1989715 main.go:48] Reading the buffer. Output is &{393056 stress-ng-vm 2025-07-25 23:11:28.623308673 +0000 UTC m=-163222.094928722 /system.slice/docker-4876bd1d7f860bacc8df1c342f058bb861c41a328a1cce0b753eae6f0849b241.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-podd993a249_6fb5_48dc_90fe_5c176fa43a7f.slice/cri-containerd-85a888cadb58adab390959abaa0db3996a9997193d137ed321dcf0e0b56c680b.scope /system.slice/docker-4876bd1d7f860bacc8df1c342f058bb861c41a328a1cce0b753eae6f0849b241.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-podd993a249_6fb5_48dc_90fe_5c176fa43a7f.slice CONSTRAINT_MEMCG}

Create stream using NewFromNow

When launched, old OOM events are ignored and net new events are reported (as seen at I0727 20:05:50.120013)

$ sudo go run oomexample/main.go -ignore_old
I0727 20:05:50.120013 1966714 main.go:48] Reading the buffer. Output is &{1967893 awk 2025-07-27 20:05:46.893944354 +0000 UTC m=+51.345637220 /system.slice/docker-8e95fa377f7d8be8aa72ddb5cf50b76111d3d6c4d89f2048c597a7b2fb6970b0.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-pod0997ebc7_7b70_4a20_9a87_c7eca4342fc9.slice/cri-containerd-cb0c72b671bad34ce5255356006d91fdd704506e8da2b51887168f29815ef9ac.scope /system.slice/docker-8e95fa377f7d8be8aa72ddb5cf50b76111d3d6c4d89f2048c597a7b2fb6970b0.scope/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-pod0997ebc7_7b70_4a20_9a87_c7eca4342fc9.slice CONSTRAINT_MEMCG}

Related

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 30 days unless new comments are made or the stale label is removed. To skip these checks, apply the "lifecycle/frozen" label.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 9, 2025
@frittentheke
Copy link

Keepalive

@dims
Copy link
Collaborator

dims commented Dec 9, 2025

@frittentheke @jesseward need this rebased and some kind of test

jesseward and others added 2 commits December 13, 2025 23:26
Ignores OOMs that occurred before the parser was created.
@jesseward jesseward force-pushed the jesseward/oomparser-ignore-old branch from 2f380de to 2fd1da8 Compare December 13, 2025 23:27
@dims dims enabled auto-merge December 16, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cadvisor/utils/oomparser - Add constructor to (optionally) allow streaming of current+new OOMs only.

3 participants