To use X-Ray you must instrument your application with the X-Ray SDK or an AWS-supported integration so that traces and segments are sent to the service.
X-Ray uses sampling by default, which means not every request will generate a trace. When troubleshooting, consider adjusting the sampling rules or temporarily disabling sampling to capture more traces. Be mindful of increased storage and cost when changing sampling rates.
Opening X-Ray in CloudWatch
Open the AWS Console and search for “X-Ray” (it appears as its own service and is integrated with CloudWatch). X-Ray provides two primary views that are useful for troubleshooting and performance analysis:Service Map
The Service Map shows nodes (clients, services, AWS resources) and the edges between them. In the demo below, a client issues requests to a Scorekeep application running in an ECS container. That container interacts with multiple DynamoDB tables and publishes to an SNS topic.
- Adjust the timeframe (last 5, 15 minutes, etc.) to focus on recent activity.
- Click any node to see metrics such as latency, request count and fault rate.
- Use the node’s “View traces” action to open traces that include that component.
Viewing Traces for a Node
Selecting “View traces” builds a filter query targeting that service. For example, to view traces involving the ScorekeepGame DynamoDB table:Inspecting a Trace and Segments
A trace contains segments (one per service, resource, or logical operation). The trace view shows a timeline with the start time and duration of each segment so you can quickly identify which operations contribute most to latency. Example segments timeline (trimmed and reformatted for readability):- Segment name and type
- Status (e.g., OK, Fault)
- Response code (HTTP or AWS operation result)
- Duration (milliseconds)
- Operation details (HTTP method/URL or API call and resource)

Common fields shown in the Traces view
Investigating Faults
When a trace contains a fault (e.g., HTTP 500), X-Ray highlights the failing segment and lets you see the call path that led to the error. This helps identify which component failed and which upstream calls preceded it. Example failing calls:- The first failing segment in the trace timeline.
- Any related downstream or upstream calls that may have contributed to the fault.
- Error messages or annotations added by your instrumentation (if available).
Working with All Traces and Building Queries
To view every trace within the selected timeframe, clear the query and run it. You can also build more advanced queries to combine services or to find specific patterns. Useful query examples:
Run queries to:
- Filter traces by service, resource ARN, or status.
- Inspect response time distributions for a service.
- Drill into individual traces for segment-level timing and error details.

Summary
AWS X-Ray gives you:- A Service Map to visualize application topology and to identify nodes of interest.
- A Traces view to investigate per-request segment timelines, durations, response codes and faults.
- A query language to filter traces by service, resource or error conditions.
- Instrument your app to send traces to X-Ray.
- Use the Service Map to find problematic nodes.
- Inspect Traces and segment timelines to find slow or failing operations.
- Build queries to focus on specific services or combinations of services.
- AWS X-Ray documentation
- CloudWatch documentation
- Instrumenting applications for X-Ray (SDKs & integrations)