This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-go.git
The following commit(s) were added to refs/heads/main by this push:
new 3981a26 fix interface nil exception (#208)
3981a26 is described below
commit 3981a26a05db6abca7c9cca218b1cdb7ae604d0e
Author: exgalibas <[email protected]>
AuthorDate: Thu Oct 10 17:02:50 2024 +0800
fix interface nil exception (#208)
Co-authored-by: lin.tan <[email protected]>
---
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 cb09112..e8c702c 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{