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

discovery: Support systems without systemd #269

Merged
merged 1 commit into from Mar 3, 2022
Merged

Conversation

xiu
Copy link
Contributor

@xiu xiu commented Mar 3, 2022

Before this commit, we only supported discovering cgroups via systemd by
reading /proc/$PID/cgroup:

[...]
1:name=systemd:/kubepods/burstable/pod1fa4240d-10d4-494f-88d2-80a639e26ac5/de86e0bfc1f648084db99ead71c756df43ec7e936342144c61d58961859a564b
[...]

On systems running openrc for instance, that line doesn't exist. Instead
we have:

1:name=openrc:/docker

With this, parca-agent would discover the cgroup_path for the job to
be /sys/fs/cgroup/perf_event, leading to parca-agent profiling
everything for every pod.

This commit adds logic to support discovering the cgroup via perf_event.
If the system is running systemd, it'll always fall back to using that
line as it is the second from the last.

Fixes #268

Before this commit, we only supported discovering cgroups via systemd by
reading /proc/$PID/cgroup:
```
[...]
1:name=systemd:/kubepods/burstable/pod1fa4240d-10d4-494f-88d2-80a639e26ac5/de86e0bfc1f648084db99ead71c756df43ec7e936342144c61d58961859a564b
[...]
```

On systems running openrc for instance, that line doesn't exist. Instead
we have:
```
1:name=openrc:/docker
```

With this, parca-agent would discover the __cgroup_path__ for the job to
be `/sys/fs/cgroup/perf_event`, leading to parca-agent profiling
everything for every pod.

This commit adds logic to support discovering the cgroup via perf_event.
If the system is running systemd, it'll always fall back to using that
line as it is the second from the last.

Fixes parca-dev#268
@CLAassistant
Copy link

CLAassistant commented Mar 3, 2022

CLA assistant check
All committers have signed the CLA.

@brancz
Copy link
Member

brancz commented Mar 3, 2022

Awesome! Thank you so much for having a look into this! lgtm 🎉

cc @kakkoyun any comments from your side?

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Awesome job 💯

@brancz brancz merged commit 350baea into parca-dev:main Mar 3, 2022
@xiu
Copy link
Contributor Author

xiu commented Mar 3, 2022

Thanks folks!

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.

Incorrect cgrouppath for a pod
4 participants