Skip to content
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

cgroup: collect pid & blkio info #36

Merged
merged 1 commit into from
Dec 17, 2024
Merged

cgroup: collect pid & blkio info #36

merged 1 commit into from
Dec 17, 2024

Conversation

kamizjw
Copy link

@kamizjw kamizjw commented Dec 6, 2024

No description provided.

@@ -114,6 +114,39 @@ pub fn collect_metrics(pid: u32) -> Result<Metrics> {
// to make it easy, fill the necessary metrics only.
for sub_system in Cgroup::subsystems(&cgroup) {
match sub_system {
Subsystem::Pid(pid_ctr) => {
let mut pid_stat = metrics.pids.take().unwrap_or_default();
pid_stat.current = pid_ctr.get_pid_current().unwrap();

Choose a reason for hiding this comment

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

maybe we should use "?" instead of unwrap

Subsystem::Pid(pid_ctr) => {
let mut pid_stat = metrics.pids.take().unwrap_or_default();
pid_stat.current = pid_ctr.get_pid_current().unwrap();
match pid_ctr.get_pid_max().unwrap() {

Choose a reason for hiding this comment

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

same as line 119

}
Subsystem::BlkIo(blkio_ctr) => {
let mut pid_stat = metrics.blkio.take().unwrap_or_default();
let mut io_service_bytes_recursive: Vec<BlkIOEntry> = Vec::new();

Choose a reason for hiding this comment

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

extra white spaces

@abel-von abel-von merged commit af8f3f0 into kuasar-io:main Dec 17, 2024
3 checks passed
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.

3 participants