From c36c444bdda630c2cbc6a4fa8a259b8633eee73d Mon Sep 17 00:00:00 2001 From: steden <1470804@qq.com> Date: Tue, 16 Jan 2024 20:59:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9A=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E9=93=BE=E8=B7=AF=E6=97=B6=EF=BC=8C=E8=A6=81?= =?UTF-8?q?=E6=B8=85=E7=A9=BAAsyncLocal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trackContext.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trackContext.go b/trackContext.go index c68dfe2..bed62f8 100644 --- a/trackContext.go +++ b/trackContext.go @@ -96,6 +96,9 @@ func (receiver *TraceContext) GetStartTs() int64 { // End 结束当前链路 func (receiver *TraceContext) End() { + // 清空当前上下文 + trace.CurTraceContext.Remove() + if receiver.ignore { return } @@ -118,6 +121,7 @@ func (receiver *TraceContext) End() { // 打印日志 receiver.printLog() } + func (receiver *TraceContext) Ignore() { receiver.ignore = true }