Failure to parse Cloud Foundry Garden container IDs
- Dominant language
- Gherkin
- Stars
- 427
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
## Description of the issue
As reported in https://github.com/elastic/apm-agent-java/issues/693 - we fail to parse the container ID from the `/proc/self/cgroup` file in Cloud Foundry Garden containers.
The algorithm used by some of the agents only looks for contiguous 64 hex digits IDs, unless we identify that this is a container within a k8 pod, in which case we take the last part of the cgroup path regardless of format (maybe have slight differences between agents).
## Proposed solution
1. parse the line and extract the last part of the path section
2. keep the current algorithm that parses the contiguous 64 hex digits IDs out this part and use it if a match is found
3. if not matched at 2, use this part as ID if matches the following pattern:
```
^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4,}
```
which is a shortened version of valid UUID (8-4-4-4-4 instead of 8-4-4-4-12)
4. if the cgroup path matches a k8 pod pattern - use this part as ID regardless of structure (current algorithm)
## Agent issues
- [x] https://github.com/elastic/apm-agent-java/issues/693
- [x] https://github.com/elastic/apm-agent-dotnet/issues/348
- [x] https://github.com/elastic/apm-agent-go/issues/576
- [ ] https://github.com/elastic/apm-agent-php/issues/555
- [ ] https://github.com/elastic/apm-agent-ruby/issues/1165
- [ ] https://github.com/elastic/apm-agent-nodejs/issues/1191
- [x] https://github.com/elastic/apm-agent-python/issues/523
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.