Soru

Zorluk: KolayInstrumenting Distributed Tracing with AWS X-Ray

A developer has enabled active tracing on an AWS Lambda function that processes incoming requests and writes data to an Amazon DynamoDB table. When viewing the traces in AWS X-Ray, the developer can see the Lambda function segment, but the downstream calls to DynamoDB are missing from the trace map. Which action should the developer take to resolve this issue?

  1. Instrument the AWS SDK client in the Lambda function code using the AWS X-Ray SDK.Cevap
  2. B
    Increase the execution timeout of the Lambda function to allow more time for tracing packets to be sent to X-Ray.
  3. C
    Change the API Gateway integration type from Lambda Proxy integration to Lambda Custom integration.
  4. D
    Initialize the DynamoDB client by hardcoding AWS access keys with permissions to write to X-Ray.

Cevap

Instrument the AWS SDK client in the Lambda function code using the AWS X-Ray SDK.
To record downstream calls to AWS services, the application code must use the AWS X-Ray SDK to wrap or instrument the AWS SDK client. For example, in Node.js, this is done by wrapping the AWS SDK with AWSXRay.captureAWS(require('aws-sdk')), or using the AWS X-Ray SDK for Java or Python equivalent. This ensures that the tracing context is propagated and downstream subsegments are created.

Adım Adım Çözüm

1
Identify the missing segment in the X-Ray trace map.
The Lambda execution segment is present, but downstream calls to DynamoDB are not captured.
This indicates that active tracing is configured on the Lambda function itself, but the downstream SDK calls are not propagating the trace context.
2
Modify the application code to wrap the AWS SDK client with the AWS X-Ray SDK.
The SDK calls are instrumented, and tracing headers are automatically generated and sent to the X-Ray daemon.
The X-Ray SDK wraps AWS SDK clients to measure downstream calls and append segment data.

Anahtar Kavram

AWS X-Ray SDK instrumentation for downstream AWS SDK calls
Bu soruyu puanla