有没有办法为spring cloud侦探2自定义Span注入和提取器? 在版本1.2的文档中,我发现了一种新版本(2)上没有的方法。我想是因为现在它使用Zipkin勇敢地照顾Span,对吧? https://cloud.spring.io/spring-cloud-sleuth/1.2.x/multi/multi__customizations.html#_example
我试图回到使用spring cloud sleuth的稳定版本(1.3.3),但是当我使用bom进行项目时,它在我使用的弹簧启动版本中产生冲突(2.0)。它与弹簧靴版本2相容吗?
我正在使用spring cloud sleuth来跟踪我公司的服务,但我有一个跟踪其他服务的版本,这些服务与opentracing标头不兼容,所以我想改变http消息的标题来制作新服务与我在其他组件中的当前跟踪标头紧密相关。
由于
答案 0 :(得分:0)
我试图回到使用spring cloud sleuth的稳定版本(1.3.3),但是当我使用bom进行项目时,它在我使用的弹簧启动版本中产生冲突(2.0)。它与弹簧靴版本2相容吗?
你不能将Sleuth 1.3与Boot 2.0一起使用。
是的,这是勇敢的改变。对于http,您可以定义自己的解析。 https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java#L57-L68。我正在使用spring cloud sleuth来跟踪我公司的服务,但我有一个跟踪其他服务的版本,这些服务与opentracing标头不兼容,所以我想改变http消息的标题来制作新服务与我在其他组件中的当前跟踪标头紧密相关。
@Autowired HttpClientParser clientParser;
@Autowired HttpServerParser serverParser;
@Autowired @ClientSampler HttpSampler clientSampler;
@Autowired(required = false) @ServerSampler HttpSampler serverSampler;
这些是您可以注册的采样器。
对于消息传递,您必须创建自己的全局通道拦截器版本 - 就像我们在此定义的那样 - https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java#L49-L53。
如果您无法接受,请继续在侦探中提出问题,以便我们在那里讨论。