aws / aws-xray-daemon

The AWS X-Ray daemon listens for traffic on UDP port 2000, gathers raw segment data, and relays it to the AWS X-Ray API.
Apache License 2.0
190 stars 69 forks source link

Improve logging for IMDS failures #190

Open willarmiros opened 1 year ago

willarmiros commented 1 year ago

When the daemon starts up, it searches for metadata about the host or container it's operating on. First it tries to ping IMDS (for EC2 hosts) then TMDE (for ECS containers). If the IMDS call fails, it logs something like:

2023-02-16T08:16:14Z [Error] Get instance id metadata failed: RequestError: send request failed

caused by: Get "http://169.254.169.254/latest/meta-data/instance-id": dial tcp 169.254.169.254:80: connect: invalid argument

However on e.g. Fargate services, the IMDS call will always fail and this is expected. We should improve this logging so that on Fargate it doesn't log any errors, and it only logs a warning if both IMDS & TMDE fail.