-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
WithContainerID: Extracts incorrect container ID in ECS. #3633
Comments
cc @Aneurysm9 |
The ECS resource detector can correctly determine the continer ID. I don't know that |
Thanks for the response @Aneurysm9, the approach you mentioned makes sense to me. I think it would still be helpful to document this limitation in |
That sounds good to me. |
WithContainerID is not able to extract the correct container id in an ECS environment. The ECS resource detector should be used instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs). See open-telemetry#3633.
* WithContainerID: Document ECS limitation. WithContainerID is not able to extract the correct container id in an ECS environment. The ECS resource detector should be used instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs). See #3633. * fix lint * Update sdk/resource/config.go --------- Co-authored-by: Tyler Yahn <[email protected]>
Description
WithContainerID
(link) extracts the container ID from/proc/self/cgroup
using the following regex. The container ID in ECS does not does not match the expected format of the regex.Extracted container ID =>
8c1e75bb325eb9c64571326952a6507132f1fc7eba7cd5b694422abe39fc7ed8
✅Extracted container ID =>
2232344121
❌Expected container ID =>
121c14dc9fd841a5a995bdfb82dd4e32-2232344121
Environment
Steps To Reproduce
Deploy a docker container with Fargate and use
WithContainerID()
.Expected behavior
The valid container ID to be added as a resource attribute in ECS.
One way to do this would be to adapt the regex if it is detected to be a Fargate environment.
Another way to do this is by leveraging
ECS_CONTAINER_METADATA_URI
(link). This endpoint returns a json containing theDockerId
(and other metadata about the container itself). opentelemetry-java uses this method to detect resource attributes on ECS (PR).The text was updated successfully, but these errors were encountered: