[英]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).我配置了一个基本的 Spring Boot with Micrometer 和 Spring Stream (with RabbitMQ)。 I would like to configure that traceId can be passed into another service through Spring Stream.
我想配置 traceId 可以通过 Spring Stream 传递到另一个服务中。
I understand it loses trace info when I use tryNextEmit.我知道当我使用 tryNextEmit 时它会丢失跟踪信息。 So it will generate a new.
所以它会生成一个新的。 I also understand, RabbitMQ messages get a "traceparent" header with "00-xxxxxx-xxx-01" new value.
我也明白,RabbitMQ 消息得到一个“traceparent”header 和“00-xxxxxx-xxx-01”新值。
So my question: How can I connect both traces that Spring Stream uses older trace information and one record appear in Zipkin?所以我的问题是:如何连接 Spring Stream 使用较旧跟踪信息和一条记录出现在 Zipkin 中的两条跟踪线?
Example code: https://github.com/Numichi/stackoverflow-question-micrometer-with-stream示例代码: https://github.com/Numichi/stackoverflow-question-micrometer-with-stream
Use StreamBridge
to send the message to Cloud Stream bindings instead of using Sink.使用
StreamBridge
将消息发送到 Cloud Stream 绑定,而不是使用 Sink。 As you have mentioned, Sink does not allow Observation Context to propagate.正如您所提到的,Sink 不允许 Observation Context 传播。 I am not aware of any direct way of propagating the context when using sinks which will allow parent Observation to be passed down.
我不知道在使用允许传递父 Observation 的接收器时传播上下文的任何直接方法。
If you send message to Stream binding using streambridge.send
then message to rabbitMQ comes under parent observation as expected and shown below如果您使用
streambridge.send
将消息发送到 Stream 绑定,则发送到 rabbitMQ 的消息会按预期受到父观察,如下所示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.