From abb401604bb979523ce57f66eab88b72a1afb305 Mon Sep 17 00:00:00 2001 From: steden <1470804@qq.com> Date: Mon, 1 Jan 2024 00:31:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=98=8E=E7=BB=86=E7=9A=84?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trace/baseTraceDetail.go | 5 +++++ trace/emptyManager.go | 3 +++ trace/iTraceContext.go | 2 ++ 3 files changed, 10 insertions(+) diff --git a/trace/baseTraceDetail.go b/trace/baseTraceDetail.go index c7611457a..7baed2553 100644 --- a/trace/baseTraceDetail.go +++ b/trace/baseTraceDetail.go @@ -16,6 +16,11 @@ var ScopeLevel = asyncLocal.New[[]BaseTraceDetail]() // BaseTraceDetail 埋点明细(基类) type BaseTraceDetail struct { + TraceId int64 // 上下文ID + AppId int64 // 应用ID + AppName string // 应用名称 + AppIp string // 应用IP + ParentAppName string // 上游应用 DetailId int64 // 明细ID ParentDetailId int64 // 父级明细ID Level int // 当前层级(入口为0层) diff --git a/trace/emptyManager.go b/trace/emptyManager.go index 5fb1ca2ab..664d612e4 100644 --- a/trace/emptyManager.go +++ b/trace/emptyManager.go @@ -63,6 +63,9 @@ func (*emptyTraceContext) AddDetail(detail ITraceDetail) func (*emptyTraceContext) GetList() []any { return []any{} } +func (*emptyTraceContext) GetAppInfo() (int64, string, int64, string, string) { + return 0, "", 0, "", "" +} type emptyTraceDetail struct{} diff --git a/trace/iTraceContext.go b/trace/iTraceContext.go index 88f08095c..9eae26462 100644 --- a/trace/iTraceContext.go +++ b/trace/iTraceContext.go @@ -17,4 +17,6 @@ type ITraceContext interface { Error(err error) // Ignore 忽略这次的链路追踪 Ignore() + // GetAppInfo 获取应用信息 + GetAppInfo() (int64, string, int64, string, string) }