项目结构调整 x 21 : 解决 opentracing 版本的冲突问题

This commit is contained in:
YunaiV 2021-05-03 10:31:29 +08:00
parent 0b5662b698
commit ab4e6d0819
9 changed files with 27 additions and 15 deletions

View File

@ -8,11 +8,11 @@ set -e
DATE=$(date +%Y%m%d%H%M) DATE=$(date +%Y%m%d%H%M)
# 基础路径 # 基础路径
BASE_PATH=/work/projects/dashboard BASE_PATH=/work/projects/yudao-admin-server
# 编译后 jar 的地址。部署时Jenkins 会上传 jar 包到该目录下 # 编译后 jar 的地址。部署时Jenkins 会上传 jar 包到该目录下
SOURCE_PATH=$BASE_PATH/build SOURCE_PATH=$BASE_PATH/build
# 服务名称。同时约定部署服务的 jar 包名字也为它。 # 服务名称。同时约定部署服务的 jar 包名字也为它。
SERVER_NAME=dashboard SERVER_NAME=yudao-admin-server
# 环境 # 环境
PROFILES_ACTIVE=dev PROFILES_ACTIVE=dev
# 健康检查 URL # 健康检查 URL

View File

@ -56,7 +56,7 @@ yudao:
db-schemas: ${spring.datasource.dynamic.datasource.master.name} db-schemas: ${spring.datasource.dynamic.datasource.master.name}
error-code: # 错误码相关配置项 error-code: # 错误码相关配置项
constants-class-list: constants-class-list:
- cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants - cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants
- cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants - cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants
debug: false debug: false

View File

@ -58,19 +58,19 @@
<!-- 本地环境 --> <!-- 本地环境 -->
<springProfile name="local"> <springProfile name="local">
<logger name="${yudao.info.base-package}" level="INFO" additivity="false"> <root level="INFO">
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 --> <appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 --> <appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
</logger> </root>
</springProfile> </springProfile>
<!-- 其它环境 --> <!-- 其它环境 -->
<springProfile name="default"> <springProfile name="default">
<logger name="${yudao.info.base-package}" level="INFO" additivity="false"> <root level="INFO">
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
<appender-ref ref="ASYNC"/> <appender-ref ref="ASYNC"/>
<appender-ref ref="GRPC"/> <appender-ref ref="GRPC"/>
</logger> </root>
</springProfile> </springProfile>
</configuration> </configuration>

View File

@ -36,6 +36,7 @@
<!-- 监控相关 --> <!-- 监控相关 -->
<skywalking.version>8.5.0</skywalking.version> <skywalking.version>8.5.0</skywalking.version>
<spring-boot-admin.version>2.3.1</spring-boot-admin.version> <spring-boot-admin.version>2.3.1</spring-boot-admin.version>
<opentracing.version>0.30.0</opentracing.version>
<!-- Test 测试相关 --> <!-- Test 测试相关 -->
<podam.version>7.2.6.RELEASE</podam.version> <podam.version>7.2.6.RELEASE</podam.version>
<jedis-mock.version>0.1.16</jedis-mock.version> <jedis-mock.version>0.1.16</jedis-mock.version>
@ -252,6 +253,11 @@
<artifactId>apm-toolkit-opentracing</artifactId> <artifactId>apm-toolkit-opentracing</artifactId>
<version>${skywalking.version}</version> <version>${skywalking.version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-util</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>
@ -379,7 +385,7 @@
<groupId>io.opentracing</groupId> <groupId>io.opentracing</groupId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<artifactId>opentracing-noop</artifactId> <artifactId>opentracing-util</artifactId>
<groupId>io.opentracing</groupId> <groupId>io.opentracing</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>

View File

@ -340,7 +340,7 @@ public class OperateLogAspect {
// 递归处理数组CollectionMap 的情况 // 递归处理数组CollectionMap 的情况
if (Collection.class.isAssignableFrom(clazz)) { if (Collection.class.isAssignableFrom(clazz)) {
return ((Collection<?>) object).stream() return ((Collection<?>) object).stream()
.anyMatch((Predicate<Object>) o -> isIgnoreArgs(object)); .anyMatch((Predicate<Object>) OperateLogAspect::isIgnoreArgs);
} }
if (Map.class.isAssignableFrom(clazz)) { if (Map.class.isAssignableFrom(clazz)) {
return isIgnoreArgs(((Map<?, ?>) object).values()); return isIgnoreArgs(((Map<?, ?>) object).values());

View File

@ -53,6 +53,10 @@
<groupId>org.apache.skywalking</groupId> <groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-opentracing</artifactId> <artifactId>apm-toolkit-opentracing</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-util</artifactId>
</dependency>
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>

View File

@ -33,7 +33,7 @@ public class YudaoTracerAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public BizTraceAspect bizTracingAop() { public BizTraceAspect bizTracingAop() {
return new BizTraceAspect(); return new BizTraceAspect(tracer());
} }
@Bean @Bean

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.tracer.core.annotation.BizTrace;
import cn.iocoder.yudao.framework.common.util.sping.SpringExpressionUtils; import cn.iocoder.yudao.framework.common.util.sping.SpringExpressionUtils;
import io.opentracing.Span; import io.opentracing.Span;
import io.opentracing.Tracer; import io.opentracing.Tracer;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
@ -22,19 +23,19 @@ import static java.util.Arrays.asList;
* @author mashu * @author mashu
*/ */
@Aspect @Aspect
@AllArgsConstructor
@Slf4j @Slf4j
public class BizTraceAspect { public class BizTraceAspect {
private static final String BIZ_OPERATION_NAME_PREFIX = "Biz/"; private static final String BIZ_OPERATION_NAME_PREFIX = "Biz/";
@Resource private final Tracer tracer;
private Tracer tracer;
@Around(value = "@annotation(trace)") @Around(value = "@annotation(trace)")
public Object around(ProceedingJoinPoint joinPoint, BizTrace trace) throws Throwable { public Object around(ProceedingJoinPoint joinPoint, BizTrace trace) throws Throwable {
// 创建 span // 创建 span
String operationName = getOperationName(joinPoint, trace); String operationName = getOperationName(joinPoint, trace);
Span span = tracer.buildSpan(operationName).startManual(); Span span = tracer.buildSpan(operationName).start();
try { try {
// 执行原有方法 // 执行原有方法
return joinPoint.proceed(); return joinPoint.proceed();

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.mq.config;
import cn.hutool.system.SystemUtil; import cn.hutool.system.SystemUtil;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener; import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
@ -26,7 +27,7 @@ import java.util.List;
* @author 芋道源码 * @author 芋道源码
*/ */
@Configuration @Configuration
@AutoConfigureAfter(YudaoMQAutoConfiguration.class) @AutoConfigureAfter(YudaoRedisAutoConfiguration.class)
@Slf4j @Slf4j
public class YudaoMQAutoConfiguration { public class YudaoMQAutoConfiguration {