将Spring Cloud Sleuth从2.0.0升级到2.1.1后,我收到失败的消息:错误:范围范围NoopSpan(dfa5ce53cfd8c8e2 / dfa5ce53cfd8c8e2)!=当前范围NoopSpan(dfa5ce53cfd8c8e2 / e2c617fa7a71a09)
这是完整的堆栈跟踪
java.lang.AssertionError: Misalignment: scoped span NoopSpan(dfa5ce53cfd8c8e2/dfa5ce53cfd8c8e2) != current span NoopSpan(dfa5ce53cfd8c8e2/e2c617fa7a71a09f)
at brave.propagation.ThreadLocalSpan.remove(ThreadLocalSpan.java:141)
at org.springframework.cloud.sleuth.instrument.messaging.TracingChannelInterceptor.finishSpan(TracingChannelInterceptor.java:374)
at org.springframework.cloud.sleuth.instrument.messaging.TracingChannelInterceptor.afterSendCompletion(TracingChannelInterceptor.java:244)
at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.afterSendCompletion(AbstractMessageChannel.java:637)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:469)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:401)
测试失败的部分是
import org.springframework.messaging.SubscribableChannel;
private SubscribableChannel inputChannel;
@Test
public void throw_exception_bad_request() {
inputChannel.send(message);
}
从我能看出的问题是,侦探正在为同一方法创建多个跨度,然后将它们进行比较,这导致了冲突?有两个日志条目清楚地显示了不同的跨度
{"time":"2019-05-06T18:00:21.663+00:00","sev":"ERROR","app":"app","evt":"dfa5ce53cfd8c8e2:dfa5ce53cfd8c8e2"
{"time":"2019-05-06T18:00:21.668+00:00","sev":"ERROR","app":"app","evt":"dfa5ce53cfd8c8e2:e2c617fa7a71a09f"
该错误正在两个不同的地方记录,但范围ID是分开的。这是它正在记录的两个地方。
return Mono.error(log.throwing(new CustomException(
"Error")));
try {
client.createCustomEvent();
} catch (Exception e) {
log.error("Error processing", e);
同样,仅当我恢复测试通过时,这种情况才发生在较新的侦探版本中。