• Guide Content

What is AWS X-Ray?

AWS X-Ray is a service developed by Amazon that enables developers to conduct performance analysis and debug distributed microservice-based applications.

This is part of an extensive series of guides about observability.

X-Ray consolidates information about an application’s architecture into a Service Map, which also includes connections to components and a dependency tree. It enables easier root cause analysis by highlighting the part of application that is problematic, offering request details such as latency, HTTP response status and number of errors.

AWS X-Ray can trace requests made to applications that span multiple AWS accounts, AWS Regions and Availability Zones, offering true end-to-end visibility.

Why X-Ray is a necessity for AWS

As the largest Cloud Service Provider in the world, Amazon has played an active role in promoting the transition from monolithic applications to microservice-based applications. They have witnessed first-hand the difficulties in identifying and solving issues in distributed systems, Jeff Barr of AWS saying:

There has been no easy way for developers to “follow-the-thread” as execution traverses EC2 instances, ECS containers, microservices, AWS database and messaging services’.

Leveraging all the data Amazon gathered since the release of their cloud computing services, they had all the necessary information to develop AWS X-Ray and release it in November 2016.

X-Ray Workflow

AWS X-Ray operates on an intuitive workflow that progresses as follows:

  1. Collect traces: X-Ray collects data from each underlying service of an application. To form an end-to-end trace, it adds an HTTP header to requests that do not already have one and passes the header along to additional tiers of request handlers.
  2. Record Traces: AWS X-Ray complies all the gathered data into traces which span from the beginning of your application workflow to the end.
  3. View Service Map: X-Ray creates a map of services used by the application using the trace data. This provides a visual representation of the connections between services in the application and aggregated data for each service.
  4. Analyze Issues: After all the traces are collected and formatted into a Service map, developers are able to drill down into the service to find exactly where and what error is taking place. Developers will be able to identify performance bottlenecks, detect segments of high latency and see the numbers of occuring errors.

X-Ray Disadvantages

While X-Ray is an easy and convenient feature to use with AWS exclusive systems, the tool lacks when it comes to tracing outside the realms of Amazon’s products. This makes third-party traces end abruptly and the resulting service map to inaccurately represent the application’s architecture. It is not possible to trace over the API gateway or track asynchronous invocations such as SNS on Kinesis. In addition, it is difficult to set up connections to developer and testing environments, or identify problems that run across multiple traces.

AWS X-Ray Pricing

As usual with AWS, X-Ray features a free tier. The first 100,000 traces recorded each month, and free for the first 1,000,000 traces retrieved or scanned each month.

Afterwards, traces recorded cost $5 for every 1,000,000 transactions, while traces received or scanned only cost $0.50 for every 1,000,000 transactions.

See Additional Guides on Key Observability Topics

Together with our content partners, we have authored in-depth guides on several other topics that can also be useful as you explore the world of observability.

OpenTelemetry

Authored by Lumigo

Serverless Monitoring

Authored by Lumigo

eBPF

Authored by Tigera