Skip to content

Commit

Permalink
修复事件消费时,上层应用名称需要取出来
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Nov 21, 2024
1 parent f9d8af5 commit 170cd37
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions traceManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,19 @@ func (receiver *traceManager) EntryEventConsumer(server, eventName, subscribeNam
// 事件消费,一般是由其它入口的程序触发的,所以这里先看能不能取到之前的上下文
var traceId string
var traceLevel int

var parentAppName string
if cur := receiver.GetCurTrace(); cur != nil {
traceId = cur.GetTraceId()
traceId, parentAppName, _, _, _ = cur.GetAppInfo()
traceLevel = cur.GetTraceLevel() + 1
} else {
traceId = strconv.FormatInt(sonyflake.GenerateId(), 10)
parentAppName = core.AppName
}
context := &TraceContext{
AppId: strconv.FormatInt(core.AppId, 10),
AppName: core.AppName,
AppIp: core.AppIp,
ParentAppName: "",
ParentAppName: parentAppName,
TraceId: traceId,
StartTs: time.Now().UnixMicro(),
TraceType: eumTraceType.EventConsumer,
Expand Down

0 comments on commit 170cd37

Please sign in to comment.