Skip to content

Commit

Permalink
调整:结束当前链路时,要清空AsyncLocal
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Jan 16, 2024
1 parent 8bfaf45 commit c36c444
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions trackContext.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func (receiver *TraceContext) GetStartTs() int64 {

// End 结束当前链路
func (receiver *TraceContext) End() {
// 清空当前上下文
trace.CurTraceContext.Remove()

if receiver.ignore {
return
}
Expand All @@ -118,6 +121,7 @@ func (receiver *TraceContext) End() {
// 打印日志
receiver.printLog()
}

func (receiver *TraceContext) Ignore() {
receiver.ignore = true
}
Expand Down

0 comments on commit c36c444

Please sign in to comment.