简体   繁体   中英

How can I configure Spring Boot 3 with Micrometer and Spring Stream (with RabbitMQ) that does not separate trace HTTP and MQ in Zipkin?

I configured a basic Spring Boot with Micrometer and Spring Stream (with RabbitMQ). I would like to configure that traceId can be passed into another service through Spring Stream.

I understand it loses trace info when I use tryNextEmit. So it will generate a new. I also understand, RabbitMQ messages get a "traceparent" header with "00-xxxxxx-xxx-01" new value.

So my question: How can I connect both traces that Spring Stream uses older trace information and one record appear in Zipkin?

Example code: https://github.com/Numichi/stackoverflow-question-micrometer-with-stream

Use StreamBridge to send the message to Cloud Stream bindings instead of using Sink. As you have mentioned, Sink does not allow Observation Context to propagate. I am not aware of any direct way of propagating the context when using sinks which will allow parent Observation to be passed down.

If you send message to Stream binding using streambridge.send then message to rabbitMQ comes under parent observation as expected and shown below在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM