elastic / elastic/apm

Failure to parse Cloud Foundry Garden container IDs

Open
#105 2 comments 0 reactions 0 assignees View on GitHub
apm-agents meta
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 Milestone
- [x] https://github.com/elastic/apm-agent-dotnet/issues/348 Milestone
- [x] https://github.com/elastic/apm-agent-go/issues/576 Milestone
- [ ] https://github.com/elastic/apm-agent-php/issues/555 Milestone
- [ ] https://github.com/elastic/apm-agent-ruby/issues/1165 Milestone
- [ ] https://github.com/elastic/apm-agent-nodejs/issues/1191 Milestone
- [x] https://github.com/elastic/apm-agent-python/issues/523 Milestone

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.