Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Container Resource MetaData auto detection in Resource SDK #1981

Closed
pavankrish123 opened this issue Jun 8, 2021 · 5 comments · Fixed by #2418
Closed

Container Resource MetaData auto detection in Resource SDK #1981

pavankrish123 opened this issue Jun 8, 2021 · 5 comments · Fixed by #2418
Labels
area:resources Part of OpenTelemetry resources enhancement New feature or request

Comments

@pavankrish123
Copy link

pavankrish123 commented Jun 8, 2021

Problem Statement

In the spirit of what was done in #1788 #1840 for Process and Operating system auto detection - It is worthwhile to have an auto detection processor that collects and reports container information container.id and container.name.

Proposed Solution

Most of the container runtime environments (Docker, CRI-O, and containerd) have this informaton in cgroup files on the container filesystem. Resource SDK initialization goes through these files and fetches it.

Alternatives

Other option is to set environment variables on containers. But that is still sort of manual thing to do or some orchestration agent does it (like K8, PAAS environement)

cc: @stevebappd

@pavankrish123 pavankrish123 added the enhancement New feature or request label Jun 8, 2021
@pavankrish123 pavankrish123 changed the title WithContainer* Resource auto detection in Resource SDK Container Resource MetaData auto detection in Resource SDK Jun 8, 2021
@jmacd
Copy link
Contributor

jmacd commented Jun 21, 2021

@pavankrish123 How would you detect the container name in K8s, by the way? I've heard concerns about using the K8s API server for this because of load.

@pavankrish123
Copy link
Author

pavankrish123 commented Jun 21, 2021

@jmacd - At least the idea is to tap into container filesystem (different locations for different runtimes) and get whatever information without touching k8 APIs. As you correctly put - accessing K8 apis is definitely not healthy.

Here is a feature our team has pushed recently on Java side open-telemetry/opentelemetry-java#3321 to do the same w/o using K8 downward APIs.

cc: @lo-jason @stevebappd

@jmacd
Copy link
Contributor

jmacd commented Jun 21, 2021

@pavankrish123 This is great to hear. Very cool!

@pavankrish123
Copy link
Author

pavankrish123 commented Jun 21, 2021

@jmacd I Fixed the description (Struck off the contianer.name ask) - I believe only container.id can be derived through filesystem (PR open-telemetry/opentelemetry-java#3321) . container.name I am not sure.

Good catch 👍🏼

Once the Java one goes through, I can port the changes to golang.

@jmacd
Copy link
Contributor

jmacd commented Jun 21, 2021

This interests me because Prometheus goes to great lengths to fill in this kind of name as a label without hammering the k8s API. If we could get basic resource information like this in the SDK itself, would be a huge win. I didn't think it was possible w/o modifying the k8s object...

@MrAlias MrAlias added the area:resources Part of OpenTelemetry resources label Jun 25, 2021
@MrAlias MrAlias added this to the Release v1.5.0 milestone Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:resources Part of OpenTelemetry resources enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants