Commit ab4e6d08191e74c99c0aaf38406fee5a820be067
1 parent
0b5662b6
项目结构调整 x 21 : 解决 opentracing 版本的冲突问题
Showing
9 changed files
with
27 additions
and
15 deletions
bin/deploy.sh
| @@ -8,11 +8,11 @@ set -e | @@ -8,11 +8,11 @@ set -e | ||
| 8 | 8 | ||
| 9 | DATE=$(date +%Y%m%d%H%M) | 9 | DATE=$(date +%Y%m%d%H%M) |
| 10 | # 基础路径 | 10 | # 基础路径 |
| 11 | -BASE_PATH=/work/projects/dashboard | 11 | +BASE_PATH=/work/projects/yudao-admin-server |
| 12 | # 编译后 jar 的地址。部署时,Jenkins 会上传 jar 包到该目录下 | 12 | # 编译后 jar 的地址。部署时,Jenkins 会上传 jar 包到该目录下 |
| 13 | SOURCE_PATH=$BASE_PATH/build | 13 | SOURCE_PATH=$BASE_PATH/build |
| 14 | # 服务名称。同时约定部署服务的 jar 包名字也为它。 | 14 | # 服务名称。同时约定部署服务的 jar 包名字也为它。 |
| 15 | -SERVER_NAME=dashboard | 15 | +SERVER_NAME=yudao-admin-server |
| 16 | # 环境 | 16 | # 环境 |
| 17 | PROFILES_ACTIVE=dev | 17 | PROFILES_ACTIVE=dev |
| 18 | # 健康检查 URL | 18 | # 健康检查 URL |
yudao-admin-server/src/main/resources/application.yaml
| @@ -56,7 +56,7 @@ yudao: | @@ -56,7 +56,7 @@ yudao: | ||
| 56 | db-schemas: ${spring.datasource.dynamic.datasource.master.name} | 56 | db-schemas: ${spring.datasource.dynamic.datasource.master.name} |
| 57 | error-code: # 错误码相关配置项 | 57 | error-code: # 错误码相关配置项 |
| 58 | constants-class-list: | 58 | constants-class-list: |
| 59 | - - cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants | ||
| 60 | - - cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants | 59 | + - cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants |
| 60 | + - cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants | ||
| 61 | 61 | ||
| 62 | debug: false | 62 | debug: false |
yudao-admin-server/src/main/resources/logback-spring.xml
| @@ -58,19 +58,19 @@ | @@ -58,19 +58,19 @@ | ||
| 58 | 58 | ||
| 59 | <!-- 本地环境 --> | 59 | <!-- 本地环境 --> |
| 60 | <springProfile name="local"> | 60 | <springProfile name="local"> |
| 61 | - <logger name="${yudao.info.base-package}" level="INFO" additivity="false"> | 61 | + <root level="INFO"> |
| 62 | <appender-ref ref="STDOUT"/> | 62 | <appender-ref ref="STDOUT"/> |
| 63 | <appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 --> | 63 | <appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 --> |
| 64 | <appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 --> | 64 | <appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 --> |
| 65 | - </logger> | 65 | + </root> |
| 66 | </springProfile> | 66 | </springProfile> |
| 67 | <!-- 其它环境 --> | 67 | <!-- 其它环境 --> |
| 68 | <springProfile name="default"> | 68 | <springProfile name="default"> |
| 69 | - <logger name="${yudao.info.base-package}" level="INFO" additivity="false"> | 69 | + <root level="INFO"> |
| 70 | <appender-ref ref="STDOUT"/> | 70 | <appender-ref ref="STDOUT"/> |
| 71 | <appender-ref ref="ASYNC"/> | 71 | <appender-ref ref="ASYNC"/> |
| 72 | <appender-ref ref="GRPC"/> | 72 | <appender-ref ref="GRPC"/> |
| 73 | - </logger> | 73 | + </root> |
| 74 | </springProfile> | 74 | </springProfile> |
| 75 | 75 | ||
| 76 | </configuration> | 76 | </configuration> |
yudao-dependencies/pom.xml
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | <!-- 监控相关 --> | 36 | <!-- 监控相关 --> |
| 37 | <skywalking.version>8.5.0</skywalking.version> | 37 | <skywalking.version>8.5.0</skywalking.version> |
| 38 | <spring-boot-admin.version>2.3.1</spring-boot-admin.version> | 38 | <spring-boot-admin.version>2.3.1</spring-boot-admin.version> |
| 39 | + <opentracing.version>0.30.0</opentracing.version> | ||
| 39 | <!-- Test 测试相关 --> | 40 | <!-- Test 测试相关 --> |
| 40 | <podam.version>7.2.6.RELEASE</podam.version> | 41 | <podam.version>7.2.6.RELEASE</podam.version> |
| 41 | <jedis-mock.version>0.1.16</jedis-mock.version> | 42 | <jedis-mock.version>0.1.16</jedis-mock.version> |
| @@ -252,6 +253,11 @@ | @@ -252,6 +253,11 @@ | ||
| 252 | <artifactId>apm-toolkit-opentracing</artifactId> | 253 | <artifactId>apm-toolkit-opentracing</artifactId> |
| 253 | <version>${skywalking.version}</version> | 254 | <version>${skywalking.version}</version> |
| 254 | </dependency> | 255 | </dependency> |
| 256 | + <dependency> | ||
| 257 | + <groupId>io.opentracing</groupId> | ||
| 258 | + <artifactId>opentracing-util</artifactId> | ||
| 259 | + <version>${opentracing.version}</version> | ||
| 260 | + </dependency> | ||
| 255 | 261 | ||
| 256 | <dependency> | 262 | <dependency> |
| 257 | <groupId>de.codecentric</groupId> | 263 | <groupId>de.codecentric</groupId> |
| @@ -379,7 +385,7 @@ | @@ -379,7 +385,7 @@ | ||
| 379 | <groupId>io.opentracing</groupId> | 385 | <groupId>io.opentracing</groupId> |
| 380 | </exclusion> | 386 | </exclusion> |
| 381 | <exclusion> | 387 | <exclusion> |
| 382 | - <artifactId>opentracing-noop</artifactId> | 388 | + <artifactId>opentracing-util</artifactId> |
| 383 | <groupId>io.opentracing</groupId> | 389 | <groupId>io.opentracing</groupId> |
| 384 | </exclusion> | 390 | </exclusion> |
| 385 | </exclusions> | 391 | </exclusions> |
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java
| @@ -340,7 +340,7 @@ public class OperateLogAspect { | @@ -340,7 +340,7 @@ public class OperateLogAspect { | ||
| 340 | // 递归,处理数组、Collection、Map 的情况 | 340 | // 递归,处理数组、Collection、Map 的情况 |
| 341 | if (Collection.class.isAssignableFrom(clazz)) { | 341 | if (Collection.class.isAssignableFrom(clazz)) { |
| 342 | return ((Collection<?>) object).stream() | 342 | return ((Collection<?>) object).stream() |
| 343 | - .anyMatch((Predicate<Object>) o -> isIgnoreArgs(object)); | 343 | + .anyMatch((Predicate<Object>) OperateLogAspect::isIgnoreArgs); |
| 344 | } | 344 | } |
| 345 | if (Map.class.isAssignableFrom(clazz)) { | 345 | if (Map.class.isAssignableFrom(clazz)) { |
| 346 | return isIgnoreArgs(((Map<?, ?>) object).values()); | 346 | return isIgnoreArgs(((Map<?, ?>) object).values()); |
yudao-framework/yudao-spring-boot-starter-monitor/pom.xml
| @@ -53,6 +53,10 @@ | @@ -53,6 +53,10 @@ | ||
| 53 | <groupId>org.apache.skywalking</groupId> | 53 | <groupId>org.apache.skywalking</groupId> |
| 54 | <artifactId>apm-toolkit-opentracing</artifactId> | 54 | <artifactId>apm-toolkit-opentracing</artifactId> |
| 55 | </dependency> | 55 | </dependency> |
| 56 | + <dependency> | ||
| 57 | + <groupId>io.opentracing</groupId> | ||
| 58 | + <artifactId>opentracing-util</artifactId> | ||
| 59 | + </dependency> | ||
| 56 | 60 | ||
| 57 | <dependency> | 61 | <dependency> |
| 58 | <groupId>de.codecentric</groupId> | 62 | <groupId>de.codecentric</groupId> |
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java
| @@ -33,7 +33,7 @@ public class YudaoTracerAutoConfiguration { | @@ -33,7 +33,7 @@ public class YudaoTracerAutoConfiguration { | ||
| 33 | @Bean | 33 | @Bean |
| 34 | @ConditionalOnMissingBean | 34 | @ConditionalOnMissingBean |
| 35 | public BizTraceAspect bizTracingAop() { | 35 | public BizTraceAspect bizTracingAop() { |
| 36 | - return new BizTraceAspect(); | 36 | + return new BizTraceAspect(tracer()); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | @Bean | 39 | @Bean |
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/core/aop/BizTraceAspect.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.tracer.core.annotation.BizTrace; | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.tracer.core.annotation.BizTrace; | ||
| 6 | import cn.iocoder.yudao.framework.common.util.sping.SpringExpressionUtils; | 6 | import cn.iocoder.yudao.framework.common.util.sping.SpringExpressionUtils; |
| 7 | import io.opentracing.Span; | 7 | import io.opentracing.Span; |
| 8 | import io.opentracing.Tracer; | 8 | import io.opentracing.Tracer; |
| 9 | +import lombok.AllArgsConstructor; | ||
| 9 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 10 | import org.aspectj.lang.ProceedingJoinPoint; | 11 | import org.aspectj.lang.ProceedingJoinPoint; |
| 11 | import org.aspectj.lang.annotation.Around; | 12 | import org.aspectj.lang.annotation.Around; |
| @@ -22,19 +23,19 @@ import static java.util.Arrays.asList; | @@ -22,19 +23,19 @@ import static java.util.Arrays.asList; | ||
| 22 | * @author mashu | 23 | * @author mashu |
| 23 | */ | 24 | */ |
| 24 | @Aspect | 25 | @Aspect |
| 26 | +@AllArgsConstructor | ||
| 25 | @Slf4j | 27 | @Slf4j |
| 26 | public class BizTraceAspect { | 28 | public class BizTraceAspect { |
| 27 | 29 | ||
| 28 | private static final String BIZ_OPERATION_NAME_PREFIX = "Biz/"; | 30 | private static final String BIZ_OPERATION_NAME_PREFIX = "Biz/"; |
| 29 | 31 | ||
| 30 | - @Resource | ||
| 31 | - private Tracer tracer; | 32 | + private final Tracer tracer; |
| 32 | 33 | ||
| 33 | @Around(value = "@annotation(trace)") | 34 | @Around(value = "@annotation(trace)") |
| 34 | public Object around(ProceedingJoinPoint joinPoint, BizTrace trace) throws Throwable { | 35 | public Object around(ProceedingJoinPoint joinPoint, BizTrace trace) throws Throwable { |
| 35 | // 创建 span | 36 | // 创建 span |
| 36 | String operationName = getOperationName(joinPoint, trace); | 37 | String operationName = getOperationName(joinPoint, trace); |
| 37 | - Span span = tracer.buildSpan(operationName).startManual(); | 38 | + Span span = tracer.buildSpan(operationName).start(); |
| 38 | try { | 39 | try { |
| 39 | // 执行原有方法 | 40 | // 执行原有方法 |
| 40 | return joinPoint.proceed(); | 41 | return joinPoint.proceed(); |
yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/config/YudaoMQAutoConfiguration.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.mq.config; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.mq.config; | ||
| 3 | import cn.hutool.system.SystemUtil; | 3 | import cn.hutool.system.SystemUtil; |
| 4 | import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | 4 | import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; |
| 5 | import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener; | 5 | import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener; |
| 6 | +import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; | ||
| 6 | import lombok.extern.slf4j.Slf4j; | 7 | import lombok.extern.slf4j.Slf4j; |
| 7 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; | 8 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
| 8 | import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; | 9 | import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; |
| @@ -26,7 +27,7 @@ import java.util.List; | @@ -26,7 +27,7 @@ import java.util.List; | ||
| 26 | * @author 芋道源码 | 27 | * @author 芋道源码 |
| 27 | */ | 28 | */ |
| 28 | @Configuration | 29 | @Configuration |
| 29 | -@AutoConfigureAfter(YudaoMQAutoConfiguration.class) | 30 | +@AutoConfigureAfter(YudaoRedisAutoConfiguration.class) |
| 30 | @Slf4j | 31 | @Slf4j |
| 31 | public class YudaoMQAutoConfiguration { | 32 | public class YudaoMQAutoConfiguration { |
| 32 | 33 |