From 3981a26a05db6abca7c9cca218b1cdb7ae604d0e Mon Sep 17 00:00:00 2001 From: exgalibas Date: Thu, 10 Oct 2024 17:02:50 +0800 Subject: [PATCH] fix interface nil exception (#208) Co-authored-by: lin.tan --- plugins/core/logreport.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/core/logreport.go b/plugins/core/logreport.go index cb09112b..e8c702c4 100644 --- a/plugins/core/logreport.go +++ b/plugins/core/logreport.go @@ -19,6 +19,7 @@ package core import ( "fmt" + "reflect" "time" "github.com/apache/skywalking-go/plugins/core/operator" @@ -111,7 +112,7 @@ func (t *Tracer) GetLogContext(withEndpoint bool) interface{} { } } entity := t.Entity() - if e, ok := entity.(operator.Entity); ok && e != nil { + if e, ok := entity.(operator.Entity); ok && e != nil && !reflect.ValueOf(e).IsNil() { serviceName, instanceName = e.GetServiceName(), e.GetInstanceName() } return &SkyWalkingLogContext{