4cc45d73
dark
将 bizType 和 bizId...
|
1
2
|
package cn.iocoder.dashboard.common.annotation;
|
7f84e44e
dark
交易链路流水号为空时打印错误日志,...
|
3
|
import cn.hutool.core.util.StrUtil;
|
4cc45d73
dark
将 bizType 和 bizId...
|
4
5
6
7
8
9
|
import cn.iocoder.dashboard.util.sping.SpElUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.apm.toolkit.trace.ActiveSpan;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
|
4cc45d73
dark
将 bizType 和 bizId...
|
10
|
import org.springframework.context.annotation.Configuration;
|
4cc45d73
dark
将 bizType 和 bizId...
|
11
|
|
5f45f73c
dark
去除无效引用,添加注释
|
12
13
14
15
16
|
/**
* 业务链路AOP切面
*
* @author mashu
*/
|
4cc45d73
dark
将 bizType 和 bizId...
|
17
18
19
20
21
22
|
@Aspect
@Slf4j
@Configuration
public class BizTracingAop {
@Around(value = "@annotation(bizTracing)")
|
5f45f73c
dark
去除无效引用,添加注释
|
23
|
public void tagBizInfo(ProceedingJoinPoint joinPoint, BizTracing bizTracing) {
|
4cc45d73
dark
将 bizType 和 bizId...
|
24
25
|
String bizId = SpElUtil.analysisSpEl(bizTracing.bizId(), joinPoint);
String bizType = SpElUtil.analysisSpEl(bizTracing.bizType(), joinPoint);
|
7f84e44e
dark
交易链路流水号为空时打印错误日志,...
|
26
27
28
29
|
if (StrUtil.isBlankIfStr(bizId)) {
log.error("empty biz: bizId[{}], bizType[{}].", bizId, bizType);
return;
}
|
4cc45d73
dark
将 bizType 和 bizId...
|
30
|
log.info("accept biz: bizId[{}], bizType[{}].", bizId, bizType);
|
7f84e44e
dark
交易链路流水号为空时打印错误日志,...
|
31
32
|
ActiveSpan.tag(BizTracing.BIZ_ID_TAG, bizId);
ActiveSpan.tag(BizTracing.BIZ_TYPE_TAG, bizType);
|
4cc45d73
dark
将 bizType 和 bizId...
|
33
34
|
}
}
|