|
|
|
@ -1,13 +1,9 @@
|
|
|
|
package cn.iocoder.yudao.framework.tracer.config;
|
|
|
|
package cn.iocoder.yudao.framework.tracer.config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum;
|
|
|
|
import cn.iocoder.yudao.framework.tracer.core.aop.BizTraceAspect;
|
|
|
|
import cn.iocoder.yudao.framework.tracer.core.aop.BizTraceAspect;
|
|
|
|
import cn.iocoder.yudao.framework.tracer.core.filter.TraceFilter;
|
|
|
|
import cn.iocoder.yudao.framework.tracer.core.filter.TraceFilter;
|
|
|
|
import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum;
|
|
|
|
|
|
|
|
import io.opentracing.Tracer;
|
|
|
|
|
|
|
|
import io.opentracing.util.GlobalTracer;
|
|
|
|
|
|
|
|
import org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer;
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
|
@ -25,24 +21,25 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
@ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true)
|
|
|
|
@ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true)
|
|
|
|
public class YudaoTracerAutoConfiguration {
|
|
|
|
public class YudaoTracerAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
// TODO @芋艿:重要。目前 opentracing 版本存在冲突,要么保证 skywalking,要么保证阿里云短信 sdk
|
|
|
|
public TracerProperties bizTracerProperties() {
|
|
|
|
// @Bean
|
|
|
|
return new TracerProperties();
|
|
|
|
// public TracerProperties bizTracerProperties() {
|
|
|
|
}
|
|
|
|
// return new TracerProperties();
|
|
|
|
|
|
|
|
// }
|
|
|
|
@Bean
|
|
|
|
//
|
|
|
|
public BizTraceAspect bizTracingAop() {
|
|
|
|
// @Bean
|
|
|
|
return new BizTraceAspect(tracer());
|
|
|
|
// public BizTraceAspect bizTracingAop() {
|
|
|
|
}
|
|
|
|
// return new BizTraceAspect(tracer());
|
|
|
|
|
|
|
|
// }
|
|
|
|
@Bean
|
|
|
|
//
|
|
|
|
public Tracer tracer() {
|
|
|
|
// @Bean
|
|
|
|
// 创建 SkywalkingTracer 对象
|
|
|
|
// public Tracer tracer() {
|
|
|
|
SkywalkingTracer tracer = new SkywalkingTracer();
|
|
|
|
// // 创建 SkywalkingTracer 对象
|
|
|
|
// 设置为 GlobalTracer 的追踪器
|
|
|
|
// SkywalkingTracer tracer = new SkywalkingTracer();
|
|
|
|
GlobalTracer.register(tracer);
|
|
|
|
// // 设置为 GlobalTracer 的追踪器
|
|
|
|
return tracer;
|
|
|
|
// GlobalTracer.register(tracer);
|
|
|
|
}
|
|
|
|
// return tracer;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 创建 TraceFilter 过滤器,响应 header 设置 traceId
|
|
|
|
* 创建 TraceFilter 过滤器,响应 header 设置 traceId
|
|
|
|
|