From e9bdda0e68b27ba096826da1a6fa975cda7fba5a Mon Sep 17 00:00:00 2001 From: Mackenzie <63265430+mackjmr@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:03:39 +0100 Subject: [PATCH] WithContainerID: Document ECS limitation. (#3639) * 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 --- sdk/resource/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/resource/config.go b/sdk/resource/config.go index 8e212b12182..f9a2a299907 100644 --- a/sdk/resource/config.go +++ b/sdk/resource/config.go @@ -194,6 +194,8 @@ func WithContainer() Option { } // WithContainerID adds an attribute with the id of the container to the configured Resource. +// Note: WithContainerID will not extract the correct container ID in an ECS environment. +// Please use the ECS resource detector instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs). func WithContainerID() Option { return WithDetectors(cgroupContainerIDDetector{}) }