繁体   English   中英

在Spring Cloud Sleuth中排除资源

[英]Exclude resources in Spring Cloud Sleuth

我正在研究将Spring Cloud Sleuth集成到我们正在构建的新的Spring Boot服务中,并希望从生成范围中排除某些URL,例如定期轮询的运行状况检查端点。

检查代码,我可以看到在TraceWebAutoConfiguration.java中创建的TraceFilter具有DEFAULT_SKIP_PATTERN,可以通过设置spring.sleuth.instrument.web.skipPattern来覆盖spring.sleuth.instrument.web.skipPattern

但是,即使我访问了DEFAULT_SKIP_PATTERN下的资源,我仍然观察到正在创建跟踪和跨度,即

17:28:46.142 [XNIO-2 task-1] INFO  o.s.c.sleuth.log.Slf4jSpanListener - Starting span: MilliSpan(begin=1454394526140, end=0, name=http/info, traceId=908b24a3-143f-4949-8f86-5df867e3985b, parents=[], spanId=908b24a3-143f-4949-8f86-5df867e3985b, remote=false, exportable=false, annotations={}, processId=null, timelineAnnotations=[])
17:28:46.143 [XNIO-2 task-1] INFO  o.s.c.sleuth.log.Slf4jSpanListener - Continued span: MilliSpan(begin=1454394526140, end=0, name=http/info, traceId=908b24a3-143f-4949-8f86-5df867e3985b, parents=[], spanId=908b24a3-143f-4949-8f86-5df867e3985b, remote=false, exportable=false, annotations={}, processId=null, timelineAnnotations=[])
17:28:46.146 [XNIO-2 task-1] INFO  io.undertow.servlet - Initializing Spring FrameworkServlet 'dispatcherServlet'
17:28:46.146 [XNIO-2 task-1] INFO  o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization started
17:28:46.170 [XNIO-2 task-1] INFO  o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization completed in 24 ms
17:28:46.216 [XNIO-2 task-1] INFO  o.s.c.sleuth.log.Slf4jSpanListener - Stopped span: MilliSpan(begin=1454394526140, end=1454394526215, name=http/info, traceId=908b24a3-143f-4949-8f86-5df867e3985b, parents=[], spanId=908b24a3-143f-4949-8f86-5df867e3985b, remote=false, exportable=false, annotations={}, processId=null, timelineAnnotations=[])

我想念什么吗? 我目前正在使用1.0.0.M4

跳过的资源不会阻止跨度的创建,只会阻止数据的收集和导出。 因此,您的日志对我来说看起来很正常。 在快照中,您会在跳过的资源中看到“ exportable”标志设置为false。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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