QA
Intermediate LevelCloud Computing (AWS/GCP/Azure)

What is AWS X-Ray and how does it map microservice dependencies and latency bottlenecks?

❓ Interview Prompt: Explain AWS X-Ray distributed tracing, Trace IDs, Subsegments, Annotations vs Metadata, and Service Maps.

In complex microservice architectures, an HTTP request may pass through API Gateway, 3 Lambda functions, SQS queues, and DynamoDB tables. AWS X-Ray provides end-to-end Distributed Tracing.

How X-Ray Operates:

1
Trace ID Propagation: Injects a unique 'X-Amzn-Trace-Id' header into incoming HTTP requests. Every downstream microservice propagates this header.
2
Service Maps: Generates visual dependency graphs showing latency metrics, error rates, and HTTP status codes per microservice node.
3
Subsegments: Measures exact execution time of internal sub-operations (e.g. database query time vs downstream API call time).

Code Implementation Example

typescript
import AWSXRay from 'aws-xray-sdk-core';
import http from 'http';

// Wrap HTTP client with X-Ray SDK to propagate trace headers automatically!
const awsHttpClient = AWSXRay.captureHTTPs(http);

// Adding custom Search Annotations (indexed for fast filtering)
const segment = AWSXRay.getSegment();
segment?.addAnnotation('CustomerId', 'CUST_1042');
segment?.addMetadata('RequestDetails', { items: 5 });
💡Instrumenting Node.js HTTP requests with AWS X-Ray distributed tracing SDK.
🎯 Interview Key Takeaway

AWS X-Ray propagates Trace IDs across microservices to generate visual service dependency maps and identify latency bottlenecks.

#AWS X-Ray#Distributed Tracing#Observability#Microservices#Intermediate
Back to all Cloud Computing (AWS/GCP/Azure) Questions→

More Cloud Computing (AWS/GCP/Azure) Interview Questions

Beginner LevelCloud Computing (AWS/GCP/Azure)

How does Serverless Architecture (AWS Lambda / GCP Cloud Run) handle Auto-Scaling and Cold Starts?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is the difference between IaaS, PaaS, and SaaS cloud service models?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is AWS EC2 and what are On-Demand, Reserved, and Spot Instance pricing models?