Home

Awesome

Build Status Go Report Card

AWS X-Ray Daemon

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. For more information, see AWS X-Ray Daemon.

Getting Help

Use the following community resources for getting help with the AWS X-Ray Daemon. We use the GitHub issues for tracking bugs and feature requests.

Sending Segment Documents

The X-Ray SDK sends segment documents to the daemon to avoid making calls to AWS directly. You can send the segment/subsegment in JSON over UDP port 2000 to the X-Ray daemon, prepended by the daemon header : {"format": "json", "version": 1}\n

{"format": "json", "version": 1}\n{<serialized segment data>}

For more details refer : Link

Installing

The AWS X-Ray Daemon is compatible with Go 1.8 and later.

Install the daemon using the following command:

go get -u github.com/aws/aws-xray-daemon/...  

Credential Configuration

The AWS X-Ray Daemon follows default credential resolution for the aws-sdk-go.

Follow the guidelines for the credential configuration.

Daemon Usage (command line args)

Usage: xray [options]

Description
-a--resource-arnAmazon Resource Name (ARN) of the AWS resource running the daemon.
-o--local-modeDon't check for EC2 instance metadata.
-m--buffer-memoryChange the amount of memory in MB that buffers can use (minimum 3).
-n--regionSend segments to X-Ray service in a specific region.
-b--bindOverrides default UDP address (127.0.0.1:2000).
-t--bind-tcpOverrides default TCP address (127.0.0.1:2000).
-r--role-arnAssume the specified IAM role to upload segments to a different account.
-c--configLoad a configuration file from the specified path.
-f--log-fileOutput logs to the specified file path.
-l--log-levelLog level, from most verbose to least: dev, debug, info, warn, error, prod (default).
-p--proxy-addressProxy address through which to upload segments.
-v--versionShow AWS X-Ray daemon version.
-h--helpShow this screen

Build

make build would build binaries and .zip files in /build folder for Linux, MacOS, and Windows platforms.

Linux

make build-linux would build binaries and .zip files in /build folder for the Linux platform.

MAC

make build-mac would build binaries and .zip files in /build folder for the MacOS platform.

Windows

make build-windows would build binaries and .zip files in /build folder for the Windows platform.

Build for ARM achitecture

Currently, the make build script builds artifacts for AMD architecture. You can build the X-Ray Daemon for ARM by using the go build command and setting the GOARCH to arm64. To build the daemon binary on a linux ARM machine, you can use the following command:

GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o xray cmd/tracing/daemon.go cmd/tracing/tracing.go

As of Aug 31, 2020, windows and darwin builds for ARM64 are not supported by go build.

Pulling X-Ray Daemon image from ECR Public Gallery

Before pulling an image you should authenticate your docker client to the Amazon ECR public registry. For registry authentication options follow this link

Run below command to authenticate to public ECR registry using get-login-password (AWS CLI)

aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws

Pull alpha tag from Public ECR Gallery

docker pull public.ecr.aws/xray/aws-xray-daemon:alpha

Pull released version tag from Public ECR Gallery

docker pull public.ecr.aws/xray/aws-xray-daemon:3.2.0

NOTE: We are not recommending to use daemon image with alpha tag in production environment. For production environment customer should pull in an image with released tag.

X-Ray Daemon Performance Report

EC2 Instance Type: T2.Micro [1 vCPU, 1 GB Memory]

Collection time: 10 minutes per TPS (TPS = Number of segments sent to daemon in 1 second)

Daemon version tested: 3.3.6

TPSAvg CPU Usage (%)Avg Memory Usage (MB)
0017.07
1000.928.5
2001.8729.3
4003.7629.1
10009.3629.5
200018.929.7
400038.329.5

Testing

make test will run unit tests for the X-Ray daemon.

License

This library is licensed under the Apache 2.0 License.