Soru

Zorluk: OrtaInstrumenting Distributed Tracing with AWS X-Ray

A developer has a Node.js application deployed in Docker containers on Amazon ECS. The application writes data to an Amazon DynamoDB table using the AWS SDK for JavaScript (v3) and calls an external payment processing API over HTTPS using the Node.js native https module. The developer has deployed the AWS X-Ray daemon container as a sidecar in the ECS task definition and verified that the daemon is running and receiving data. However, the X-Ray console only shows the container node without any downstream nodes for DynamoDB or the payment API.

Which two actions should the developer take to ensure that both the DynamoDB calls and the external HTTPS API calls are instrumented and visible in the X-Ray service map?

  1. Instrument the DynamoDB client using the captureAWSv3Client function from the AWS X-Ray SDK.Cevap
  2. Call the captureHTTPsGlobal function from the AWS X-Ray SDK to automatically trace downstream HTTPS calls.Cevap
  3. C
    Hardcode the AWS access key and secret access key in the X-Ray SDK configuration using AWS.config.update().
  4. D
    Configure the API Gateway integration type as a custom integration rather than a proxy integration to pass X-Ray headers.
  5. E
    Increase the visibility timeout of the SQS queue that processes the messages to allow the X-Ray daemon more time to flush its buffer.

Cevap

Instrument the DynamoDB client using the captureAWSv3Client function from the AWS X-Ray SDK, and call the captureHTTPsGlobal function from the AWS X-Ray SDK to automatically trace downstream HTTPS calls.
To achieve distributed tracing in Node.js applications, the AWS SDK client must be instrumented explicitly (via captureAWSv3Client for SDK v3), and native HTTP/HTTPS modules must be wrapped (via captureHTTPsGlobal) to capture downstream third-party service calls.

Adım Adım Çözüm

1
Identify the AWS SDK instrumentation method for JavaScript SDK v3.
Determine that wrapping the DynamoDB client with the captureAWSv3Client function from the AWS X-Ray SDK enables tracing for DynamoDB calls.
By default, the SDK clients are not instrumented and their requests are not sent to the X-Ray daemon.
2
Identify the HTTP/HTTPS tracing method for external API calls in Node.js.
Determine that invoking captureHTTPsGlobal at the entry point of the application instruments the native HTTP/HTTPS modules.
This allows the X-Ray SDK to intercept and record downstream HTTP/HTTPS requests to the payment API.

Anahtar Kavram

To trace downstream calls in AWS X-Ray, developers must instrument both the AWS SDK clients and any HTTP/HTTPS clients using the language-specific AWS X-Ray SDK.
Bu soruyu puanla