Home > Software design >  How to send and consume sleuth traceId in SQS
How to send and consume sleuth traceId in SQS

Time:11-20

I'm using spring-cloud-sleuth.version:3.0.4 and spring-cloud-aws-messaging:2.2.6.RELEASE

It correctly propogates trace id with HTTP requests.

However, it seems that it doesn't work with SQS.

Is there any way to automatically send and consume sleuth traceId with SQS communication.

CodePudding user response:

Spring Cloud AWS is now a community project, see: https://awspring.io/ The current release train of Spring Cloud (2020.x), where you can find Sleuth 3.x does not include/support it.

You should use io.awspring.cloud:spring-cloud-aws-messaging:2.3.x instead of org.springframework.cloud:spring-cloud-aws-messaging:2.2.x with the current release train of Spring Cloud (2020.x).

Because of these, Sleuth does not instrument Spring AWS Messaging directly but if you can use SQS in a way that integrates with Spring Integration/Messaging/Stream/something that is already instrumented, this could work; i.e.: I would try using QueueMessageChannel and the annotations, I don't think QueueMessagingTemplate will work.

Another thing you can do is manually instrument it and propagate tracing information in the headers, see: TraceSpringMessagingAutoConfiguration

  • Related