A developer is troubleshooting a serverless application where an AWS Lambda function written in C# (.NET) processes order events. The Lambda function is invoked by an Amazon API Gateway REST API. The function makes downstream HTTP calls to a third-party payment gateway and performs read/write operations on an Amazon DynamoDB table. Active tracing is enabled on both the API Gateway stage and the Lambda function. However, when inspecting the AWS X-Ray console, the developer observes that while the API Gateway and Lambda function segments appear, the HTTP calls to the payment gateway and the DynamoDB operations are missing from the trace.
Which of the following actions should the developer take to record the downstream calls in the X-Ray traces?
- AExtract the X-Amzn-Trace-Id header from the API Gateway event inside the Lambda handler and manually assign it to the environment variables of the Lambda execution environment before invoking downstream services.
- Use the AWS X-Ray SDK for .NET to call AWSSDKHandler.RegisterXRayForAllServices() at application startup, and initialize HttpClient using the HttpClientXRayTracingHandler class.Answer
- CHardcode an IAM user access key and secret key with the AWSXrayWriteOnlyAccess policy when initializing the DynamoDB client and HTTP clients to authenticate directly with the X-Ray daemon.
- DIncrease the Lambda function's timeout configuration to allow enough time for the X-Ray daemon to flush segment data and implement client-side connection pooling to handle execution context reuse.