A developer is instrumenting a Go-based microservice running on Amazon ECS with the EC2 launch type to trace incoming HTTP requests, downstream HTTP client calls, and calls to Amazon DynamoDB using AWS X-Ray. The X-Ray daemon is already running on the container host instances. Which of the following actions must the developer take to instrument the application and ensure downstream traces are recorded? (Select TWO.)
- Instrument the AWS SDK clients using the X-Ray SDK for Go and wrap the HTTP client's transport with the X-Ray RoundTripper.Cevap
- Pass the Go context containing the active segment to downstream AWS SDK operations and HTTP client calls.Cevap
- CHardcode temporary AWS IAM credentials within the application's SDK client configuration to authorize calls to the X-Ray daemon.
- DConfigure the AWS SDK clients without passing the Go context object, as the Go X-Ray SDK automatically registers a global listener that intercepts and correlates all downstream calls.
- EConfigure the Amazon SQS queue's visibility timeout to be shorter than the database processing time to force X-Ray to flush trace segments.
Cevap
To instrument the Go application for AWS X-Ray, the developer must instrument the AWS SDK clients and HTTP client transport, and explicitly pass the Go context containing the active segment to all downstream calls.
Instrumenting the SDK clients and HTTP transport with X-Ray SDK helpers enables subsegment generation for outgoing requests. Since Go lacks thread-local storage, context must be explicitly passed to propagate the active trace segment.
Adım Adım Çözüm
Anahtar Kavram
Go X-Ray SDK Instrumentation and Context Propagation