X-Ray 是一項服務,收集您應用程序所服務的請求的相關數據,並提供用於查看、篩選和獲取數據洞察力的工具,以肯定問題和發現優化的機會。對於任何被跟蹤的對您應用程序的請求,您不只能夠查看請求和響應的詳細信息,還能夠查看您的應用程序對下游 AWS 資源、微服務、數據庫和 HTTP Web API 進行的調用的詳細信息。html
X-Ray 開發工具包提供:前端
攔截器,可添加到您的代碼中以跟蹤傳入 HTTP 請求git
客戶端處理程序,可分析您的應用程序用來調用其餘 AWS 服務的 AWS 開發工具包客戶端github
HTTP 客戶端,用於分析對其餘內部和外部 HTTP Web 服務的調用web
Interceptors to add to your code to trace incoming HTTP requests數據庫
Client handlers to instrument AWS SDK clients that your application uses to call other AWS services後端
An HTTP client to use to instrument calls to other internal and external HTTP web servicesapp
該開發工具包還支持分析對 SQL 數據庫的調用、自動 AWS 開發工具包客戶端分析以及其餘功能。ide
該開發工具包不是直接將跟蹤數據發送到 X-Ray,而是將 JSON 分段文檔發送到偵聽 UDP 流量的守護程序進程。X-Ray 守護程序將分段緩衝在隊列中,並將分段批量上傳到 X-Ray。該守護程序可用於 Linux、Windows 和 macOS,且包含在 AWS Elastic Beanstalk 和 AWS Lambda 平臺上。微服務
X-Ray 使用來自支持您的雲應用程序的 AWS 資源的跟蹤數據生成詳細的服務圖。該服務圖顯示客戶端、您的前端服務以及前端服務調用來處理請求和保存數據的後端服務。您可使用服務圖來查明瓶頸、延遲峯值和其餘須要解決的問題,以提升應用程序性能。
The AWS X-Ray daemon is a software application that listens for traffic on UDP port 2000, gathers raw segment data, and relays it to the AWS X-Ray API. The daemon works in conjunction with the AWS X-Ray SDKs and must be running so that data sent by the SDKs can reach the X-Ray service.
Note
The X-Ray daemon is an open source project. You can follow the project and submit issues and pull requests on GitHub: github.com/aws/aws-xray-daemon
On AWS Lambda and AWS Elastic Beanstalk, use those services' integration with X-Ray to run the daemon. Lambda runs the daemon automatically any time a function is invoked for a sampled request. On Elastic Beanstalk, use the XRayEnabled configuration option to run the daemon on the instances in your environment.
To run the X-Ray daemon locally, on-premises, or on other AWS services, download it from Amazon S3, run it, and then give it permission to upload segment documents to X-Ray.