Asynchronous tracing using Xray

0

Is there a way to enable tracing for my ECS services that connects each other via Amazon MQ ?

I have two services which running in ECS cluster. Service A receives incoming requests via ALB. It does.something and post message to Queue (Lets say it is QueueA). Listener that listens message from QueueA is part of service B. It recieves message from QueueA , process it and sends to another Queue/some other services.

I know that currently Amazon MQ doesn't support Xray. Is there anyway to trace the complete flow?
I have lots of micro services that is integrated via Amazon MQ.

asked 4 years ago650 views
2 Answers
0

Hi,

It seems like it could be possible, although bear with me as I'm not too familiar with Amazon MQ. If you are able to customize headers that are propagated for messages in MQ, then it should be possible. The process would be something like this:

You should be able to enable ALB to generate a trace header following this documentation: https://docs.aws.amazon.com/xray/latest/devguide/xray-services-elb.html

Next, you'll need to attach that X-Ray trace header to Amazon MQ messages so that service A and B will be part of the same trace. To learn more about the trace header see: https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracingheader

So, a header will be passed into Service A from ALB, then service A can propagate the header over Amazon MQ to service B. You should instrument both services with the X-Ray SDK (available in 6 languages) to parse the trace header and create a segment for each service: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java.html

And you'll also need to set up the daemon in your ECS environments to send segments from your services to the X-Ray backend: https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon-ecs.html

Hope this helps as a workaround!

AWS
answered 4 years ago
0

Thanks William.

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions