From 7f84e44e94d79cc33a109cbd415c981886bf3b73 Mon Sep 17 00:00:00 2001 From: dark <189192663@qq.com> Date: Thu, 18 Mar 2021 22:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A4=E6=98=93=E9=93=BE=E8=B7=AF=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E5=8F=B7=E4=B8=BA=E7=A9=BA=E6=97=B6=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97,=E4=B8=94=E4=B8=8D?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=93=BE=E8=B7=AF=E8=87=B3skywalking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/dashboard/common/annotation/BizTracing.java | 8 ++++---- .../dashboard/common/annotation/BizTracingAop.java | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) 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); } }