-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
libbeat: override /sys/fs/cgroup paths in Docker #22879
Conversation
This is ready for review, but I've marked it Draft as I haven't created a new release for gosigar yet. If the PR is approved in principle, I'll go ahead and tidy it up. |
So we're basically passing this along to |
Thanks for taking a look @fearful-symmetry! I'll clean it up now and make it ready for a final review.
Yes, it's just passed straight along and the interesting bits are in gosigar/cgroup.
Do you mean internal/dev docs, or end-user docs? Either way, do you have an idea of where in particular? This "feature" is really a Docker-specific hack, and is hard-coded in the Dockerfile. It should just work without ever requiring user intervention. It's intentionally undocumented in Elasticsearch (elastic/elasticsearch#22757), so I hadn't planned to document it either. |
When running in Docker, make sure metrics are read from `/sys/fs/cgroup/<subsystem>`, ignoring any paths in `/proc/self/cgroup`. Fixes elastic#22844
I'll need some guidance here please. I think the only sensible way to test this is with an end-to-end test that runs a Docker image generated from the Dockerfile.tmpl template. Do we have any tests like this? |
Pinging @elastic/integrations-services (Team:Services) |
I'm guessing
This is too tiny for a unit test and I'm not sure if we have any end-to-end testing that would work here. We might have to skip this. |
What would be the purpose of documenting it there? This environment variable is an internal implementation detail, and not something users should have to know or care about.
OK. I've opened #22948 to address this. |
Yah, that's a good point. I suppose the comments in |
Also, |
Oops! Thanks, updated. |
Uh, I don't think the remaining CI errors are related? |
Yup, looks like it's a known issue: elastic/e2e-testing#535 |
Thanks for the review @fearful-symmetry ! |
* libbeat: override /sys/fs/cgroup paths in Docker When running in Docker, make sure metrics are read from `/sys/fs/cgroup/<subsystem>`, ignoring any paths in `/proc/self/cgroup`. Fixes elastic#22844 (cherry picked from commit 7e1520f)
What does this PR do?
This PR adds an undocumented environment variable,
LIBBEAT_MONITORING_CGROUPS_HIERARCHY_OVERRIDE
, which can be used to override where cgroup metrics are found. This follows the approach taken by Elasticsearch (elastic/elasticsearch#22757), Kibana, and Logstash. The environment variable is set (to "/") in the Docker images.Why is it important?
Under Docker, the paths in
/proc/<pid>/cgroup
do not have corresponding paths under/sys/fs/cgroup/<subsystem>
. Instead, we should assume a root cgroup and read directly from the files in the subsystem directories.Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
PLATFORMS=linux/amd64 TYPES=docker mage package
)docker image load < build/distributions/filebeat-8.0.0-linux-amd64.docker.tar.gz
Related issues
Fixes #22844