Core Concepts
- Trace: end-to-end request path. Segment: work done by a single service. Subsegment: downstream calls.
- Trace ID propagates via the X-Amzn-Trace-Id header across services.
- X-Ray daemon listens on UDP port 2000 and batches trace data to the X-Ray API.
- For Lambda, X-Ray is enabled via the function configuration (Active Tracing). No daemon needed.
Annotations & Metadata
- Annotations: key-value pairs that are indexed. Use for filtering and grouping traces (e.g., user_id, order_status).
- Metadata: key-value pairs that are NOT indexed. Use for non-searchable debug data.
- Both are attached to segments or subsegments.
Sampling Rules
- Default: 1 request/second + 5% of additional requests.
- Custom rules: set reservoir (fixed per-second) and rate (percentage) per service/path.
- Sampling reduces cost and volume without losing visibility into traffic patterns.
Service Maps & Analysis
- Service map shows the topology of traced services, latency, error rates, and throughput.
- Filter expressions let you query traces by annotation, URL, status code, response time, etc.
- X-Ray integrates with CloudWatch ServiceLens for unified observability.
- X-Ray SDK available for Java, Node.js, Python, .NET, Go, Ruby.
Practice X-Ray Questions
Put your knowledge to the test with practice questions.