问题描述
我们正在努力与Webflux保持互动.我们正在将Jaegar与Istio结合使用以进行检测.
We are trying to go reactive with Webflux. We are using Jaegar with Istio for instrumentation purposes.
Jaegar很好地了解了Spring MVC端点,但似乎根本不适用于WebFlux.
Jaegar understands Spring MVC endpoints well, but don't seem to work at all for WebFlux.
我正在寻找使我的webflux端点出现在Jaeger中的建议.
I am looking for suggestions to make my webflux endpoints appear in Jaeger.
先谢谢了.
推荐答案
继续使用Jaegar的最佳方法是不要使用JAEGAR CLIENT!
The best way to move forward in order to use Jaegar is NOT TO USE JAEGAR CLIENT!
Jaegar具有收集Zipkin跨度的功能:
Jaegar has the ability to collect Zipkin spans:
https://www.jaegertracing.io/docs/1.8/getting-started/#migrating-from-zipkin
您应该利用此优势,并使用下面的Sleuth + Zipkin依赖项,并在您的Spring Boot应用程序中排除Jaegar代理jar.
You should take advantage of this and use the below Sleuth+Zipkin dependency and exclude Jaegar agent jars in your spring boot app.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
默认情况下,以上操作会将Zipkin范围发送到 http://localhost:9411 .您可以在Spring Boot应用程序中覆盖此名称,以通过覆盖zipkin基本URL轻松地指向Jaegar服务器.
The above will send Zipkin spans to http://localhost:9411 by default. You can override this in your Spring Boot app to point to your Jaegar server easily by overriding the zipkin base URL.
Sleuth将完成所有繁重的工作,默认日志记录将记录span和traceIds.
Sleuth will do all the heavy lifting and the default logging will log the span and traceIds.
在log4j2.xml文件中,您只需要提及
In the log4j2.xml file, all you have to mention is
您可以在此处找到示例代码:
You can find the sample code here:
https://github.com/anoophp777/spring-webflux-jaegar-log4j2
这篇关于如何在Spring WebFlux中使用Jaeger?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!