Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support cgroup v2 for getting container ID #1358

Closed
tbradellis opened this issue Jun 27, 2023 · 1 comment · Fixed by #1529
Closed

Support cgroup v2 for getting container ID #1358

tbradellis opened this issue Jun 27, 2023 · 1 comment · Fixed by #1529
Assignees
Labels
2 Story Point Estimate oct-dec qtr Represents proposed work item for the Oct-Dec quarter

Comments

@tbradellis
Copy link
Contributor

tbradellis commented Jun 27, 2023

The issue

In 2021 linux distributions rolled out cgroup v2.
This resulted in a change to how docker container ID is exposed.
In cgroup v1, we read /proc/self/cgroup and pattern match to find the container id.

private static final String FILE_WITH_CONTAINER_ID = "/proc/self/cgroup";

This results in the agent not sending container id in the connect payload for utilization metrics on hosts using cgroup v2.

Feature Description

The same information in cgroup c2 can be found in /proc/self/mountinfo through a similar pattern match.
The feature request is to support both cgroup v2 and cgroup v1
A reference can be found here with the open telemetry project:
open-telemetry/opentelemetry-java-instrumentation#7167

Describe Alternatives

There is an open issue on the open container initiative site to address this in a more generalized way so that changes like this do not break this as easily.
The main alternative would be to wait for this open issue to play out and use that solution.
opencontainers/runtime-spec#1105

Because this is used for for utilization calculations, we need to move faster on implementing a solution. Also, there is no guarantee that a generalized abstraction will be implemented.

Additional context

This information is used for utilization and is provided as part of the connect payload. An agent-spec issue as also been created, as this impacts all language agents.

There's additional helpful information and links on this stackoverflow post:
https://stackoverflow.com/questions/68816329/how-to-get-docker-container-id-from-within-the-container-with-cgroup-v2

@workato-integration
Copy link

@kford-newrelic kford-newrelic added estimate Issue needing estimation oct-dec qtr Represents proposed work item for the Oct-Dec quarter labels Sep 18, 2023
@kanderson250 kanderson250 self-assigned this Sep 20, 2023
@kanderson250 kanderson250 moved this to In progress in Java Engineering Board Sep 20, 2023
@kford-newrelic kford-newrelic added 2 Story Point Estimate and removed estimate Issue needing estimation labels Sep 21, 2023
@kanderson250 kanderson250 moved this from In progress to Needs Review in Java Engineering Board Sep 29, 2023
@github-project-automation github-project-automation bot moved this from Needs Review to Code Complete/Done in Java Engineering Board Sep 29, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
2 Story Point Estimate oct-dec qtr Represents proposed work item for the Oct-Dec quarter
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants