Commit 6fa060c48bce0072b89cd018d6950409c1814695
1 parent
acf722f7
fix:【framework 框架】注释 opentracing.Tracer 和 skywalking Tracer 不兼容的问题,后续换 opentelemetry
Showing
1 changed file
with
16 additions
and
24 deletions
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java
| 1 | package cn.iocoder.yudao.framework.tracer.config; | 1 | package cn.iocoder.yudao.framework.tracer.config; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; |
| 4 | -import cn.iocoder.yudao.framework.tracer.core.aop.BizTraceAspect; | ||
| 5 | import cn.iocoder.yudao.framework.tracer.core.filter.TraceFilter; | 4 | import cn.iocoder.yudao.framework.tracer.core.filter.TraceFilter; |
| 6 | -import io.opentracing.Tracer; | ||
| 7 | -import io.opentracing.util.GlobalTracer; | ||
| 8 | -import org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer; | ||
| 9 | import org.springframework.boot.autoconfigure.AutoConfiguration; | 5 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| 11 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| @@ -20,32 +16,28 @@ import org.springframework.context.annotation.Bean; | @@ -20,32 +16,28 @@ import org.springframework.context.annotation.Bean; | ||
| 20 | */ | 16 | */ |
| 21 | @AutoConfiguration | 17 | @AutoConfiguration |
| 22 | @ConditionalOnClass(name = { | 18 | @ConditionalOnClass(name = { |
| 23 | - "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer", | ||
| 24 | - "io.opentracing.Tracer", | 19 | + "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer", // 来自 apm-toolkit-opentracing.jar |
| 20 | +// "io.opentracing.Tracer", // 来自 opentracing-api.jar | ||
| 25 | "jakarta.servlet.Filter" | 21 | "jakarta.servlet.Filter" |
| 26 | }) | 22 | }) |
| 27 | @EnableConfigurationProperties(TracerProperties.class) | 23 | @EnableConfigurationProperties(TracerProperties.class) |
| 28 | @ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true) | 24 | @ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true) |
| 29 | public class YudaoTracerAutoConfiguration { | 25 | public class YudaoTracerAutoConfiguration { |
| 30 | 26 | ||
| 31 | - @Bean | ||
| 32 | - public TracerProperties bizTracerProperties() { | ||
| 33 | - return new TracerProperties(); | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - @Bean | ||
| 37 | - public BizTraceAspect bizTracingAop() { | ||
| 38 | - return new BizTraceAspect(tracer()); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - @Bean | ||
| 42 | - public Tracer tracer() { | ||
| 43 | - // 创建 SkywalkingTracer 对象 | ||
| 44 | - SkywalkingTracer tracer = new SkywalkingTracer(); | ||
| 45 | - // 设置为 GlobalTracer 的追踪器 | ||
| 46 | - GlobalTracer.registerIfAbsent(tracer); | ||
| 47 | - return tracer; | ||
| 48 | - } | 27 | + // TODO @芋艿:skywalking 不兼容最新的 opentracing 版本。同时,opentracing 也停止了维护,尬住了!后续换 opentelemetry 即可! |
| 28 | +// @Bean | ||
| 29 | +// public BizTraceAspect bizTracingAop() { | ||
| 30 | +// return new BizTraceAspect(tracer()); | ||
| 31 | +// } | ||
| 32 | +// | ||
| 33 | +// @Bean | ||
| 34 | +// public Tracer tracer() { | ||
| 35 | +// // 创建 SkywalkingTracer 对象 | ||
| 36 | +// SkywalkingTracer tracer = new SkywalkingTracer(); | ||
| 37 | +// // 设置为 GlobalTracer 的追踪器 | ||
| 38 | +// GlobalTracer.registerIfAbsent(tracer); | ||
| 39 | +// return tracer; | ||
| 40 | +// } | ||
| 49 | 41 | ||
| 50 | /** | 42 | /** |
| 51 | * 创建 TraceFilter 过滤器,响应 header 设置 traceId | 43 | * 创建 TraceFilter 过滤器,响应 header 设置 traceId |