从Spring云探测器到微米,

swvgeqrz  于 5个月前  发布在  Spring
关注(0)|答案(1)|浏览(39)

因此,由于Spring云侦探是停止为 Spring Boot 3.0即时通讯转移到微米。我读了两个依赖添加

<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>

字符串
我使用slueth自动配置来添加所有服务的日志中的所有跟踪和跨度ID,通过feign在调用的头部传播ID并将其添加到日志中。我还使用tracer来获取自定义日志的当前跟踪ID。
现在,我需要为spring添加哪些依赖项来自动配置我需要的这两件事?(跟踪器和添加跟踪和span id到下游服务的日志和头)以及如果我缺少任何东西。编辑:已经添加了这2个配置属性

#to trace all calls (micrometer only does 10% of calls by default)
management.tracing.sampling.probability=1.0
#to add trace and span id in all calls (isnt done by default)
logging.pattern.level= "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

whhtz7ly

whhtz7ly1#

您需要勇敢的桥梁和执行器。如果您使用的是 Boot 3. 2或更高的logging.pattern.level是不需要的。

相关问题