Open eyalkoren opened 5 years ago
I edited the proposed algorithm to keep the current logic so that if the cgroup path matches a k8 pod, we use the last part of the path regardless of its structure.
Depending on whether systemd or cgroupfs is being used, we also need to cater for the last path segment ending in ".scope". This was in the original Docker container ID issue (https://github.com/elastic/apm/issues/22#issuecomment-442284817) so hopefully it's already being catered for, but thought I'd mention it again here for completeness.
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
which is a shortened version of valid UUID (8-4-4-4-4 instead of 8-4-4-4-12)
Agent issues