SHA256
86 lines
3.1 KiB
Markdown
86 lines
3.1 KiB
Markdown
# X-Ray
|
|
AWS [[_X-Ray|X-Ray]] is a AWS Managed service for diagnosing issues (performance and failures) in a microservice architecture. The main idea is that you pass headers in your calls, AWS picks up on those headers and looks at the propagation of the requests across bits of AWS.
|
|
|
|
It's a distributed tracing system.
|
|
|
|
## Anatomy of X-Ray
|
|
|
|
```mermaid
|
|
flowchart LR
|
|
API["X-Ray API"] --> Console["X-Ray Console"]
|
|
Daemon["X-Ray Daemon"] --> API
|
|
SDK["X-Ray SDK"] --> Daemon
|
|
Other["Other Clients:\nAWS SDK or AWS CLI"] --> API
|
|
Other --> Daemon
|
|
API --> Other
|
|
```
|
|
|
|
## X-Ray SDK
|
|
- The SDK provides **interceptors** to trace HTTP requests
|
|
- **Client handlers** to **instrument** AWS SDK clients that your application uses to call other AWS Services
|
|
- A HTTP Client to use to instrument calls to other internal and external HTTP web services
|
|
|
|
## X-Ray Instrumentation
|
|
Measure he level of product's performance to diagnose errors and write trace information.
|
|
|
|
## X-Ray-Daemon
|
|
It buffers segments into a queue and uploads in batches.
|
|
It's available to be installed on Linux, Windows, Mac
|
|
Comes with [[_Elastic BeanStalk]] and [[_Lambda]] by default.
|
|
|
|
## X-Ray Concepts
|
|
* **Segments**:
|
|
* Details about the host (IP address/kind of host).
|
|
* Request information.
|
|
* The time/duration.
|
|
* Errors and Faults.
|
|
* Response Statuses.
|
|
|
|
* **Subsegments**:
|
|
* More granular timing information.
|
|
* Can contain calls to other AWS services
|
|
|
|
* **Service Graph**:
|
|
* Just the UI graph in the Console.
|
|
|
|
* **Traces**:
|
|
* A Trace ID is the path of a request through your application.
|
|
* Gets passed along to everything else, so that it can be tracked.
|
|
* Not every trace gets recorded.
|
|
|
|
* **Sampling**:
|
|
* [[_X-Ray|AWS X-Ray]] uses a sampling algorithm to determine which requests get traced.
|
|
* Default is:
|
|
* The first request each second...
|
|
* And 5% of any additional requests.
|
|
* Idea is to reduce service charges when you are getting started. The default sampling rate is low.
|
|
* You can create limits for the rates
|
|
|
|
* **Tracing Header**:
|
|
* All requests are traced up to a configurable minimum.
|
|
* After that minimum, a percentage of requests are traced to avoid unnecessary cost. (See above)
|
|
* [The sampling decision and the trace ID are added to HTTP requests in tracing headers named `X-Amzn-Trace-Id`.]{.underline}
|
|
* The Tracing Header determines if the trace shows up in the viewer.
|
|
|
|
* **Filter Expressions**:
|
|
* Applications make a lot of data, you can filter it
|
|
|
|
* **Groups**:
|
|
* Named Filter Expressions.
|
|
* Groups only update after you update them, the data before still remains (subsequent traces only)
|
|
|
|
* **Annotations**:
|
|
* Up to 50 annotations per trace.
|
|
* Use to record data that you want to group traces in the console, or when calling the `GetTraceSummaries` API.
|
|
|
|
* **Metadata**:
|
|
* Metadata are not indexed and values can be any type, including lists and objects.
|
|
* Use Metadata to record data you want to store in the trace but don't need to use for searching traces.
|
|
|
|
* **Errors, Faults, and Exceptions**:
|
|
* X-Ray records the Stack Trace and exception details if available.
|
|
|
|
|
|
|
|
|