cgroups v2 container.id discovery
- Dominant language
- Gherkin
- Stars
- 427
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
cgroups v2 is increasingly seeing adoption as various distributions have made it the default for containers. As noted in https://github.com/elastic/beats/issues/16958, Fedora 31 (late 2019) enables it by default, Ubuntu 21.10 does as well.
The current [spec](https://github.com/elastic/apm/blob/master/specs/agents/metadata.md#containerkubernetes-metadata) covers only cgroups v1, this issue is a feature request for v2 support.
**Describe the solution you'd like**
When running applications on systems with cgroups v2 enabled, for example on docker, `container.id` should be filled in for events produced by APM agents.
**Additional context**
The current [metrics spec](https://github.com/elastic/apm/blob/9dd05a8be598c36a75e73681a38d158b54d29373/specs/agents/metrics.md) touches on collecting cgroups v2 metrics without specific guidance on how to identify the cgroup itself, that should be updated as well. The [java](https://github.com/elastic/apm-agent-java/blob/2e40422635e573bf83da84c67a325d2bf629a91a/apm-agent-core/src/main/java/co/elastic/apm/agent/metrics/builtin/CGroupMetrics.java#L115-L123) and [python](https://github.com/elastic/apm-agent-python/blob/7d5d7117536f314205a33950e6d5f1d98757f17a/elasticapm/metrics/sets/cpu_linux.py#L124-L131) agents may provide insight into the updates required, like consulting `/proc/self/mountinfo` instead of `/proc/self/cgroup` when cgroups v2 are detected.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.