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 140c58d fix sql instrument with DBQueryContext (#168) 140c58d is described below commit 140c58d3991786942ca759cc254e1891e09dd49b Author: GlqEason <36256450+glqea...@users.noreply.github.com> AuthorDate: Tue Feb 20 17:48:11 2024 +0800 fix sql instrument with DBQueryContext (#168) --- CHANGES.md | 1 + plugins/sql/entry/span.go | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 9e329ec..6c55762 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -25,6 +25,7 @@ Release Notes. * Fix wrong tracing context when trace have been sampled. * Fix enhance param error when there are multiple params. * Fix lost trace when multi middleware `handlerFunc` in `gin` plugin. +* Fix DBQueryContext execute error in `sql` plugin. #### Issues and PR - All issues are [here](https://github.com/apache/skywalking/milestone/197?closed=1) diff --git a/plugins/sql/entry/span.go b/plugins/sql/entry/span.go index e60f194..be3264b 100644 --- a/plugins/sql/entry/span.go +++ b/plugins/sql/entry/span.go @@ -54,6 +54,13 @@ func getInstanceInfo(caller interface{}) InstanceInfo { if !ok || instance == nil { return nil } - info := instance.GetSkyWalkingDynamicField().(InstanceInfo) + df := instance.GetSkyWalkingDynamicField() + if df == nil { + return nil + } + info, ok := df.(InstanceInfo) + if !ok { + return nil + } return info }