diff --git a/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracing.java b/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracing.java index 3b67bf70b..d254552d1 100644 --- a/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracing.java +++ b/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracing.java @@ -13,11 +13,11 @@ import java.lang.annotation.*; */ public @interface BizTracing { - String BIZ_ID = "bizId"; - String BIZ_TYPE = "bizType"; + String BIZ_ID_TAG = "bizId"; + String BIZ_TYPE_TAG = "bizType"; - String bizId() default "NULL_ID"; + String bizId(); - String bizType() default "NULL_TYPE"; + String bizType(); } diff --git a/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracingAop.java b/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracingAop.java index 9486d4d19..f8b2241b6 100644 --- a/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracingAop.java +++ b/src/main/java/cn/iocoder/dashboard/common/annotation/BizTracingAop.java @@ -1,5 +1,6 @@ package cn.iocoder.dashboard.common.annotation; +import cn.hutool.core.util.StrUtil; import cn.iocoder.dashboard.util.sping.SpElUtil; import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.apm.toolkit.trace.ActiveSpan; @@ -22,8 +23,12 @@ public class BizTracingAop { public void tagBizInfo(ProceedingJoinPoint joinPoint, BizTracing bizTracing) { String bizId = SpElUtil.analysisSpEl(bizTracing.bizId(), joinPoint); String bizType = SpElUtil.analysisSpEl(bizTracing.bizType(), joinPoint); + if (StrUtil.isBlankIfStr(bizId)) { + log.error("empty biz: bizId[{}], bizType[{}].", bizId, bizType); + return; + } log.info("accept biz: bizId[{}], bizType[{}].", bizId, bizType); - ActiveSpan.tag(BizTracing.BIZ_ID, bizId); - ActiveSpan.tag(BizTracing.BIZ_TYPE, bizType); + ActiveSpan.tag(BizTracing.BIZ_ID_TAG, bizId); + ActiveSpan.tag(BizTracing.BIZ_TYPE_TAG, bizType); } }