"container.id" resource attribute is wrong for ECS Fargate #2032
Labels
bug
Something isn't working
pkg:resource-detector-aws
priority:p2
Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
What version of OpenTelemetry are you using?
What version of Node are you using?
NodeJS 18
What did you do?
We are using Resource Detector AWS similar to the documentation and found the container.id resource attribute is wrong in ECS Fargate.
The resource detector ooks at the cgroup file and pulls the last 64 characters.
That works fine for ECS on EC2. Example:
But generates an incorrect value in Fargate, because the schema is different:
What did you expect to see?
In Fargate, I expect to see the correct Container ID, which is
a3490942f53a40d0a39674bdb52d443e-3300241379
.According to the ECS metadata information, a Fargate container ID "a 32-digit hex followed by a 10 digit number."
What did you see instead?
I saw
40d0a39674bdb52d443e/a3490942f53a40d0a39674bdb52d443e-3300241379
, which is the container ID prepended with other, incorrect, data.Additional context
While it would be nice to pull the container ID from the ECS metadata endpoint, I'm not sure if there's a way to deterministically get the ID for the local container. The logic to get the container ID from the cgroup file should probably get updated to split on/
and grab the last value. It looks like that will work for both ECS on EC2 and ECS on Fargate.EDIT:
The Resource detector is already pulling the
containerMetadata
(info about the local container) andtaskMetdata
(info about the task). TheDockerID
is available from thecontainerMetadata
for both ECS on EC2 and ECS on Fargate, so I believe the best solution would be to update the detector to pull the ID from there.The text was updated successfully, but these errors were encountered: