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) }