-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add stats function to task #217
Conversation
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
let mut metrics = Metrics::new(); | ||
let hier = hierarchies::auto(); | ||
let cgroup: Cgroup; | ||
if hier.v2() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact, hier
means "yesterday" in french :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
This commits adds CPUAcct and Pid metircs to report to containerd Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
This commit uses the cpu controller to collect stats from the CPU instead of the cpuacct controller. Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
I am now able to get more metrics, including CPU and PIDs!! ➜ runwasi git:(stats) ✗ sudo ctr task metric testwasm
ID TIMESTAMP
testwasm seconds:1690930464 nanos:407172844
METRIC VALUE
memory.usage_in_bytes 18649088
memory.limit_in_bytes 0
memory.stat.cache 0
cpuacct.usage 3545445
cpuacct.usage_percpu []
pids.current 9
pids.limit 0 |
Just ran the |
can we re-use the work you did in containerd/rust-extensions#163? |
sure that's my intention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
I'm super excited to start seeing metrics being produced.
Will merge this now |
This PR adds a new
stats
function to the implementation of a Task. It usescgroups_rs
crate to get the memory stats from cgroup subsystems, which is largely inspired by how containerd runc shim is implemented in rust-extensions repo.This is currently work-in-process but I want to get it out there so to collect some early feedback.
If you want to test it, you can use
ctr task metric <task-name>
to print out the memory usage of the taskTODO:
Closes #208