AWS X-Ray


- AWS X-Ray helps developers to analyze and debug distributed applications.
- X-Ray provides an end-to-end view of requests as they travel through the application, and shows a map of the application’s underlying components.
- X-Ray helps to understand how the application and its underlying services are performing to identify and troubleshoot the root cause of performance issues and errors.
- X-Ray can be used with distributed applications of any size to trace and debug both synchronous requests and asynchronous events.
- X-Ray can be used to track requests flowing through applications or services across multiple regions. X-Ray data is stored locally to the processed region and customers can build a solution over it to combine the data.
- Trace data sent to X-Ray is generally available for retrieval and filtering within 30 seconds of it being received by the service.
- X-Ray stores trace data for the last 30 days.
X-Ray Main Concept
Trace
- An X-Ray trace is a set of data points that share the same trace ID.
- Trace helps track the request, which is assigned a unique trace id, while it navigates through services
- Piece of information relayed by each service in the application to X-Ray is a segment, and a trace is a collection of segments.
Segment
- An X-Ray segment encapsulates all the data points for a single component of the distributed application for e.g. authorization component
- Segments include system-defined and user-defined data in the form of annotations and are composed of one or more sub-segments that represent remote calls made from the service. for e.g. database call and its result within the overall request/response
Annotation
- An X-Ray annotation is system-defined or user-defined data
- Annotation is associated with a segment and a segment can contain multiple annotations.
- System-defined annotations include data added to the segment by AWS services
- User-defined annotations are metadata added to a segment by a developer
Errors
- X-Ray errors are system annotations associated with a segment for a call that results in an error response.
- Error includes the error message, stack trace, and any additional information for e.g, version to associate the error with a source file.
Sampling
- X-Ray collects data for significant number of requests, instead of each request sent to an application, for performant and cost-effectiveness
- X-Ray should not be used as an audit or compliance tool because it does not guarantee data completeness.
X-Ray agent
- X-Ray agent helps collect data from log files and sends them to the X-Ray service for aggregation, analysis, and storage.
- Agent makes it easier for you to send data to the X-Ray service, instead of using the APIs directly, and is
- Agent is available for Amazon Linux AMI, Red Hat Enterprise Linux (RHEL), and Windows Server 2012 R2 or later operating systems.