A developer has a serverless application consisting of Amazon API Gateway, an AWS Lambda function, and an Amazon DynamoDB table. The developer enables active tracing on both the API Gateway stage and the Lambda function. However, when inspecting the AWS X-Ray service map, the developer notices that downstream DynamoDB service calls are missing from the trace path. Which of the following actions is required to ensure that DynamoDB calls are included in the distributed trace?
- Instrument the AWS SDK client inside the Lambda function code using the AWS X-Ray SDK to capture downstream calls.Cevap
- BRely solely on the active tracing setting in the Lambda function configuration, as this automatically instruments all downstream AWS SDK clients.
- CHardcode an IAM user access key and secret key with AWS X-Ray write permissions directly in the Lambda function initialization code.
- DIncrease the Amazon SQS visibility timeout of the downstream queue to allow the X-Ray daemon more time to buffer trace segments.
Cevap
Instrument the AWS SDK client inside the Lambda function code using the AWS X-Ray SDK to capture downstream calls.
The correct answer is to instrument the AWS SDK client inside the Lambda function code using the AWS X-Ray SDK. Enabling active tracing on Lambda only enables tracing of the function invocation itself. To trace downstream calls to other AWS resources, the AWS SDK client must be explicitly instrumented using the AWS X-Ray SDK so that the trace context is passed and recorded.
Adım Adım Çözüm
Anahtar Kavram
Instrumenting AWS SDK clients in code is required to trace downstream service calls in AWS X-Ray.