A developer is troubleshooting a Java application running on Amazon ECS Fargate that receives HTTP requests and uses the AWS SDK for Java to write metadata to an Amazon DynamoDB table. The developer runs the AWS X-Ray daemon as a sidecar container in the ECS task. The X-Ray daemon logs confirm that it is successfully receiving trace segments and uploading them to AWS X-Ray. However, in the X-Ray trace map, the downstream calls to DynamoDB do not appear. Which action should the developer take to ensure DynamoDB calls are included in the trace?
- Configure the AWS SDK client in the Java application using the X-Ray SDK's TracingInterceptor to instrument downstream service calls.Cevap
- BHardcode AWS credentials directly in the X-Ray SDK client initialization code to authenticate with the X-Ray daemon.
- CAdjust the SQS visibility timeout to allow more time for the X-Ray daemon to collect asynchronous trace segments.
- DModify the DynamoDB integration response in API Gateway to map the proxy headers dynamically.
Cevap
Configure the AWS SDK client in the Java application using the X-Ray SDK's TracingInterceptor to instrument downstream service calls.
To include downstream calls in an AWS X-Ray trace, the application's AWS SDK client must be instrumented. For Java applications, this is done by adding the X-Ray SDK's TracingInterceptor to the AWS SDK client configuration, which automatically creates subsegments for each downstream service call.
Adım Adım Çözüm
Anahtar Kavram
AWS SDK Client Instrumentation with AWS X-Ray SDK