Menu
AWS X-Ray
Developer Guide

Integrating AWS X-Ray with AWS Services

Other AWS services provide integration with AWS X-Ray by adding trace IDs to requests, making sampling decisions, or uploading trace data to X-Ray.

Note

The X-Ray SDKs include plugins for additional integration with AWS services. For example, you can use the X-Ray SDK for Java's Elastic Beanstalk plugin to add information about the Elastic Beanstalk environment that runs your application including the environment name and ID.

Elastic Load Balancing

Elastic Load Balancing application load balancers add a trace ID to incoming HTTP requests in a header named X-Amzn-Trace-Id.

X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793

Trace ID Format

A trace_id consists of three numbers separated by hyphens. For example, 1-58406520-a006649127e371903a2de979. This includes:

  • The version number, that is, 1.

  • The time of the original request, in Unix epoch time, in 8 hexadecimal digits.

    For example, 10:00AM December 2nd, 2016 PST in epoch time is 1480615200 seconds, or 58406520 in hexadecimal.

  • A 96-bit identifier for the trace, globally unique, in 24 hexadecimal digits.

Amazon API Gateway

Amazon API Gateway gateways add a trace ID to incoming HTTP requests in a header named X-Amzn-Trace-Id.

X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793

Trace ID Format

A trace_id consists of three numbers separated by hyphens. For example, 1-58406520-a006649127e371903a2de979. This includes:

  • The version number, that is, 1.

  • The time of the original request, in Unix epoch time, in 8 hexadecimal digits.

    For example, 10:00AM December 2nd, 2016 PST in epoch time is 1480615200 seconds, or 58406520 in hexadecimal.

  • A 96-bit identifier for the trace, globally unique, in 24 hexadecimal digits.

API Gateway does not propagate X-Ray trace ID and sampling headers. If your gateway is downstream of other services in your application, traces will terminate at the gateway. If the gateway chooses to sample the request, it will continue with a different trace ID.

Amazon Elastic Compute Cloud

You can install and run the X-Ray daemon on an Amazon EC2 instance with a user data script. See Running the X-Ray Daemon on Amazon EC2 for instructions.

Use an instance profile to grant the daemon permission to upload trace data to X-Ray. For more information, see Giving the Daemon Permission to Send Data to X-Ray.

AWS Elastic Beanstalk

AWS Elastic Beanstalk platforms include the X-Ray daemon. You can run the daemon by setting an option in the Elastic Beanstalk console or with a configuration file.

On the Java SE platform, you can use a Buildfile file to build your application with Maven or Gradle on-instance. The X-Ray SDK for Java and AWS SDK for Java are available from Maven, so you can deploy only your application code and build on-instance to avoid bundling and uploading all of your dependencies.

For more information, see Configuring AWS X-Ray Debugging in the AWS Elastic Beanstalk Developer Guide.