AWS Certified Developer – Associate (DVA-C02)Troubleshooting and MonitoringMedium

A company uses AWS X-Ray to trace requests through a microservices architecture. A developer notices that while individual service calls are being traced, the end-to-end trace view often shows disconnected segments, or a new trace starts for subsequent service calls, rather than continuing the original trace. All services are instrumented with the X-Ray SDK. Which of the following is the MOST likely cause of this issue?

  1. AThe X-Ray SDK is not correctly capturing HTTP headers for trace context propagation.
  2. BThe X-Ray daemon is not running on all EC2 instances hosting the microservices.
  3. CThe sampling rules configured in X-Ray are too aggressive, causing some segments to be dropped.
  4. DThe IAM role associated with the microservices does not have sufficient permissions to send data to X-Ray.
Show answer & explanation

Correct answer: A. The X-Ray SDK is not correctly capturing HTTP headers for trace context propagation.

Disconnected segments or new traces starting indicate a failure in trace context propagation. The X-Ray SDK relies on HTTP headers (e.g., X-Amzn-Trace-Id) to pass the trace ID and parent segment ID between services. If these headers are not correctly forwarded or captured, the X-Ray SDK in the downstream service will start a new trace instead of continuing the existing one.

Why the other options are wrong

  • B. If the X-Ray daemon wasn't running, no segments from that service would be reported at all, not just disconnected ones.
  • C. Aggressive sampling rules would cause entire traces or segments to be dropped entirely, not just disconnect them while still reporting other segments.
  • D. Insufficient IAM permissions would result in 'Access Denied' errors in logs and no trace data being sent, not partially connected traces.

X-Ray Trace Context Propagation

X-Ray trace context propagation is the mechanism by which the trace ID and parent segment ID are passed between interconnected services in a distributed application, typically using HTTP headers (e.g., X-Amzn-Trace-Id), to build a complete end-to-end trace.

  • Crucial for linking segments across services.
  • Uses HTTP headers (e.g., X-Amzn-Trace-Id).
  • Failure leads to disconnected traces or new traces.

Memory trick: X-Ray needs its 'Context' to 'Link' all the service calls together.

More Troubleshooting and Monitoring questions