not able to configure aws x-ray using php

142 views Asked by At

i'm using the third party library from https://github.com/patrickkerrigan/php-xray since aws do not have any x-ray sdk for php

this is how i trace my application using the library

however, i'm not able to see any traceses is made the trace view map


Trace::getInstance() 
    ->setName('my-app')
    ->setUrl('http://example.com') 
    ->setMethod('GET')
    ->begin();

echo 'my function'; 

Trace::getInstance()
    ->end() 
    ->setResponseCode(http_response_code())
    ->setError(http_response_code() >= 400 && http_response_code() < 500)
    ->setFault(http_response_code() >= 500)
    ->submit(new \Pkerrigan\Xray\Submission\DaemonSegmentSubmitter());

1

There are 1 answers

0
Carol Abadeer On

AWS X-Ray does not vend an SDK for PHP, but we do vend the AWS Distro for OpenTelemetry in PHP. You can use OpenTelemetry PHP to instrument libraries that are supported in OpenTelemetry PHP (including AWS SDK) and/or manually create spans as necessary and export traces to AWS X-Ray.

The ADOT documentation contains detailed instructions on getting started and setting up all the components to send trace data to the AWS X-Ray backend. We also provide a sample app that can be used to get started with using ADOT PHP.