XRay client

This page contains examples with the XRay client. See the client introduction for a more detailed description how to use a client. You may also want to consider the authentication documentation to understand the many ways you can authenticate with AWS.

The XRay package could be installed with Composer.

composer require async-aws/x-ray

A new client object may be instantiated by:

use AsyncAws\XRay\XRayClient; $xRay = new XRayClient();

The authentication parameters is read from the environment by default. You can also specify a AWS access id and secret:

use AsyncAws\XRay\XRayClient; $xRay = new XRayClient([ 'accessKeyId' => 'my_access_key', 'accessKeySecret' => 'my_access_secret', 'region' => 'eu-central-1', ]);

For all available options, see the configuration reference.


Put trace segments

use AsyncAws\XRay\Input\PutTraceSegmentsInput; use AsyncAws\XRay\XRayClient; $xRay = new XRayClient(); $xRay->publish(new PutTraceSegmentsInput([ 'TraceSegmentDocuments' => [ json_encode([ 'name' => 'service-foo', 'id' => '1111111111111111', 'trace_id' => '1-58406520-a006649127e371903a2de979', 'start_time' => 1480615200.010, 'end_time' => 1480615200.090, ]), ], ]));

The source code to this page is found on GitHub.