How to integrate AWS X-Ray tracing with Amazon MQ?

Viewed 144

Is there anyway feasible to trace messages sent by Amazon MQ? Currently, we have API getting the request and sending a message to another application, which is needed to be traced. As there is no official documentation and support regarding the integration of AWS X-Ray into Amazon MQ, any help would be appreciated on how this can be implemented

1 Answers

If you are able to customize headers that are propagated for messages in MQ, then the X-Ray tracing will works without issues.

You need to enable your AWS service to generate a trace header following this documentation: Integrating AWS X-Ray with other AWS services

eg. For a EC2 instance will you need to install and run the X-Ray daemon

Then, you will need to attach that X-Ray trace header to Amazon MQ messages so that Application A and B will be part of the same trace, to learn more about the trace header take a look here: AWS X-Ray - Tracing header

In this way, a header will be passed into the Application A, then Application A can propagate the header over Amazon MQ to Application B. You should instrument both services with the X-Ray SDK to parse the trace header and create a segment for each service.

Eg. To work with the SDK for Node.js take a look here AWS X-Ray: Working with Node.js

Related