You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2024/10/10 09:02:56 UTC
(skywalking-go) branch main updated: fix interface nil exception (#208)
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 <ex...@gmail.com>
AuthorDate: Thu Oct 10 17:02:50 2024 +0800
fix interface nil exception (#208)
Co-authored-by: lin.tan <li...@mobvista.com>
---
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{