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 dea904d  Add support for go-redis (#55)
dea904d is described below

commit dea904d33000c8a0e2ef9fed4fc8b395376d79cd
Author: Jiekun <[email protected]>
AuthorDate: Thu Jun 8 16:50:46 2023 +0800

    Add support for go-redis (#55)
---
 .github/workflows/plugin-tests.yaml                |   1 +
 CHANGES.md                                         |   1 +
 docs/en/agent/support-plugins.md                   |   4 +-
 go.work                                            |   3 +
 plugins/core/tracing/span.go                       |   5 +
 plugins/go-redisv9/go.mod                          |  13 ++
 plugins/go-redisv9/go.sum                          |  23 +++
 plugins/go-redisv9/hook.go                         | 189 +++++++++++++++++++++
 plugins/go-redisv9/instrument.go                   | 107 ++++++++++++
 plugins/go-redisv9/intercepter.go                  |  63 +++++++
 plugins/go-redisv9/op_type.go                      | 136 +++++++++++++++
 test/plugins/scenarios/go-redisv9/bin/startup.sh   |  22 +++
 .../scenarios/go-redisv9/config/excepted.yml       | 101 +++++++++++
 test/plugins/scenarios/go-redisv9/go.mod           |  24 +++
 test/plugins/scenarios/go-redisv9/go.sum           | 181 ++++++++++++++++++++
 test/plugins/scenarios/go-redisv9/main.go          | 123 ++++++++++++++
 test/plugins/scenarios/go-redisv9/plugin.yml       |  40 +++++
 tools/go-agent/instrument/plugins/register.go      |   2 +
 18 files changed, 1037 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/plugin-tests.yaml 
b/.github/workflows/plugin-tests.yaml
index 026d661..2d1fec5 100644
--- a/.github/workflows/plugin-tests.yaml
+++ b/.github/workflows/plugin-tests.yaml
@@ -59,6 +59,7 @@ jobs:
           - gin
           - http
           - dubbo
+          - go-redisv9
           - go-restfulv3
           - gorm
           - kratosv2
diff --git a/CHANGES.md b/CHANGES.md
index 1140f2b..ea7b236 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,6 +8,7 @@ Release Notes.
 * Enhance the plugin rewrite ability to support `switch` and `if/else` in the 
plugin codes.
 
 #### Plugins
+* Support [go-redis](https://github.com/redis/go-redis) v9 redis client 
framework.
 
 #### Documentation
 
diff --git a/docs/en/agent/support-plugins.md b/docs/en/agent/support-plugins.md
index 6951aac..1f77b85 100644
--- a/docs/en/agent/support-plugins.md
+++ b/docs/en/agent/support-plugins.md
@@ -12,4 +12,6 @@
   * `microv4`: [Go-Micro](https://github.com/go-micro/go-micro)
 * Database Client
   * `gorm`: [GORM](https://github.com/go-gorm/gorm)
-    * [MySQL Driver](https://github.com/go-gorm/mysql)
\ No newline at end of file
+    * [MySQL Driver](https://github.com/go-gorm/mysql)
+* Cache Client
+  * `go-redisv9`: [go-redis](https://github.com/redis/go-redis)
\ No newline at end of file
diff --git a/go.work b/go.work
index 790b5e8..ae2c3bd 100644
--- a/go.work
+++ b/go.work
@@ -8,6 +8,7 @@ use (
        ./plugins/dubbo
        ./plugins/gin
        ./plugins/http
+       ./plugins/go-redisv9
        ./plugins/go-restfulv3
        ./plugins/gorm
        ./plugins/kratosv2
@@ -22,6 +23,7 @@ use (
        ./test/plugins/scenarios/dubbo
        ./test/plugins/scenarios/gin
        ./test/plugins/scenarios/http
+       ./test/plugins/scenarios/go-redisv9
        ./test/plugins/scenarios/go-restfulv3
        ./test/plugins/scenarios/gorm
        ./test/plugins/scenarios/kratosv2
@@ -30,4 +32,5 @@ use (
        ./test/plugins/scenarios/plugin_exclusion
 
        ./tools/go-agent
+
 )
diff --git a/plugins/core/tracing/span.go b/plugins/core/tracing/span.go
index 9a55571..82e5279 100644
--- a/plugins/core/tracing/span.go
+++ b/plugins/core/tracing/span.go
@@ -59,6 +59,11 @@ const (
        TagMQQueue         = "mq.queue"
        TagMQBroker        = "mq.broker"
        TagMQTopic         = "mq.topic"
+       TagCacheType       = "cache.type"
+       TagCacheOp         = "cache.op"
+       TagCacheCmd        = "cache.cmd"
+       TagCacheKey        = "cache.key"
+       TagCacheArgs       = "cache.args"
 )
 
 // WithLayer set the SpanLayer of the Span
diff --git a/plugins/go-redisv9/go.mod b/plugins/go-redisv9/go.mod
new file mode 100644
index 0000000..6260bf4
--- /dev/null
+++ b/plugins/go-redisv9/go.mod
@@ -0,0 +1,13 @@
+module github.com/apache/skywalking-go/plugins/go-redisv9
+
+go 1.18
+
+require (
+       github.com/redis/go-redis/v9 v9.0.5
+)
+
+require (
+       github.com/cespare/xxhash/v2 v2.2.0 // indirect
+       github.com/dave/dst v0.27.2 // indirect
+       github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // 
indirect
+)
diff --git a/plugins/go-redisv9/go.sum b/plugins/go-redisv9/go.sum
new file mode 100644
index 0000000..b269a6f
--- /dev/null
+++ b/plugins/go-redisv9/go.sum
@@ -0,0 +1,23 @@
+github.com/apache/skywalking-go/plugins/core 
v0.0.0-20230531133153-0c54f7fe6e62 
h1:geTGEa3GDXLbgAjJnzHliEVsL9rShyJMPI4oXdTuS+4=
+github.com/apache/skywalking-go/plugins/core 
v0.0.0-20230531133153-0c54f7fe6e62/go.mod 
h1:P0tAFNAYJUNsiTlFQgxmCcRcu+7Y0MP8GBZfSI449CM=
+github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
+github.com/bsm/ginkgo/v2 v2.7.0/go.mod 
h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w=
+github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
+github.com/bsm/gomega v1.26.0/go.mod 
h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
+github.com/cespare/xxhash/v2 v2.2.0 
h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
+github.com/cespare/xxhash/v2 v2.2.0/go.mod 
h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/dave/dst v0.27.2 h1:4Y5VFTkhGLC1oddtNwuxxe36pnyLxMFXT51FOzH8Ekc=
+github.com/dave/dst v0.27.2/go.mod 
h1:jHh6EOibnHgcUW3WjKHisiooEkYwqpHLBSX1iOBhEyc=
+github.com/davecgh/go-spew v1.1.1 
h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f 
h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod 
h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
+github.com/pmezard/go-difflib v1.0.0 
h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 
h1:EaDatTxkdHG+U3Bk4EUr+DZ7fOGwTfezUiUJMaIcaho=
+github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5/go.mod 
h1:fyalQWdtzDBECAQFBJuQe5bzQ02jGd5Qcbgb97Flm7U=
+github.com/redis/go-redis/v9 v9.0.5 
h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl5o=
+github.com/redis/go-redis/v9 v9.0.5/go.mod 
h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
+github.com/stretchr/testify v1.8.2 
h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
+golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
+golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
+golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
diff --git a/plugins/go-redisv9/hook.go b/plugins/go-redisv9/hook.go
new file mode 100644
index 0000000..380c80b
--- /dev/null
+++ b/plugins/go-redisv9/hook.go
@@ -0,0 +1,189 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package goredisv9
+
+import (
+       "context"
+       "fmt"
+       "net"
+       "strings"
+
+       "github.com/apache/skywalking-go/plugins/core/tracing"
+
+       "github.com/redis/go-redis/v9"
+)
+
+const (
+       GoRedisComponentID = 5014
+       GoRedisCacheType   = "redis"
+)
+
+type redisHook struct {
+       Addr string
+}
+
+func newRedisHook(addr string) *redisHook {
+       return &redisHook{
+               Addr: addr,
+       }
+}
+
+func (r *redisHook) DialHook(next redis.DialHook) redis.DialHook {
+       return func(ctx context.Context, network, addr string) (net.Conn, 
error) {
+               s, err := tracing.CreateExitSpan(
+                       // operationName
+                       GoRedisCacheType+"/"+"dial",
+
+                       // peer
+                       r.Addr,
+
+                       // injector
+                       func(k, v string) error {
+                               return nil
+                       },
+
+                       // opts
+                       tracing.WithComponent(GoRedisComponentID),
+                       tracing.WithLayer(tracing.SpanLayerCache),
+                       tracing.WithTag(tracing.TagCacheType, GoRedisCacheType),
+               )
+
+               if err != nil {
+                       err = fmt.Errorf("go-redis :skyWalking failed to create 
exit span, got error: %v", err)
+                       return nil, err
+               }
+
+               defer s.End()
+
+               conn, err := next(ctx, network, addr)
+               if err != nil {
+                       recordError(s, err)
+               }
+               return conn, err
+       }
+}
+
+func (r *redisHook) ProcessHook(next redis.ProcessHook) redis.ProcessHook {
+       return func(ctx context.Context, cmd redis.Cmder) error {
+               s, err := tracing.CreateExitSpan(
+                       // operationName
+                       GoRedisCacheType+"/"+cmd.FullName(),
+
+                       // peer
+                       r.Addr,
+
+                       // injector
+                       func(k, v string) error {
+                               return nil
+                       },
+
+                       // opts
+                       tracing.WithComponent(GoRedisComponentID),
+                       tracing.WithLayer(tracing.SpanLayerCache),
+                       tracing.WithTag(tracing.TagCacheType, GoRedisCacheType),
+                       tracing.WithTag(tracing.TagCacheOp, 
getCacheOp(cmd.FullName())),
+                       tracing.WithTag(tracing.TagCacheCmd, cmd.FullName()),
+                       tracing.WithTag(tracing.TagCacheKey, 
getKey(cmd.Args())),
+                       tracing.WithTag(tracing.TagCacheArgs, cmd.String()),
+               )
+
+               if err != nil {
+                       err = fmt.Errorf("go-redis :skyWalking failed to create 
exit span, got error: %v", err)
+                       return err
+               }
+
+               defer s.End()
+
+               if err = next(ctx, cmd); err != nil {
+                       recordError(s, err)
+                       return err
+               }
+
+               return nil
+       }
+}
+
+func (r *redisHook) ProcessPipelineHook(next redis.ProcessPipelineHook) 
redis.ProcessPipelineHook {
+       return func(ctx context.Context, cmds []redis.Cmder) error {
+               summary := ""
+               summaryCmds := cmds
+               if len(summaryCmds) > 10 {
+                       summaryCmds = summaryCmds[:10]
+               }
+               for i := range summaryCmds {
+                       summary += summaryCmds[i].FullName() + "/"
+               }
+               if len(cmds) > 10 {
+                       summary += "..."
+               }
+
+               s, err := tracing.CreateExitSpan(
+                       // operationName
+                       "redis/pipeline",
+
+                       // peer
+                       r.Addr,
+
+                       // injector
+                       func(k, v string) error {
+                               return nil
+                       },
+
+                       // opts
+                       tracing.WithComponent(GoRedisComponentID),
+                       tracing.WithLayer(tracing.SpanLayerCache),
+                       tracing.WithTag(tracing.TagCacheType, GoRedisCacheType),
+                       tracing.WithTag(tracing.TagCacheCmd, 
"pipeline:"+strings.TrimRight(summary, "/")),
+               )
+               if err != nil {
+                       err = fmt.Errorf("go-redis :skyWalking failed to create 
exit span, got error: %v", err)
+                       return err
+               }
+
+               defer s.End()
+
+               if err = next(ctx, cmds); err != nil {
+                       recordError(s, err)
+                       return err
+               }
+
+               return nil
+       }
+}
+
+func recordError(span tracing.Span, err error) {
+       if err != redis.Nil {
+               span.Error(err.Error())
+       }
+}
+
+// getKey Try to transform the second argument into string
+// e.g. "GET my_key" -> "my_key"
+func getKey(args []interface{}) string {
+       key := ""
+       if len(args) >= 2 {
+               k := args[1]
+               switch v := k.(type) {
+               case string:
+                       key = v
+               default:
+                       break
+               }
+       }
+       return key
+}
diff --git a/plugins/go-redisv9/instrument.go b/plugins/go-redisv9/instrument.go
new file mode 100644
index 0000000..dec8517
--- /dev/null
+++ b/plugins/go-redisv9/instrument.go
@@ -0,0 +1,107 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package goredisv9
+
+import (
+       "embed"
+       "strings"
+
+       "github.com/apache/skywalking-go/plugins/core/instrument"
+)
+
+//go:embed *
+var fs embed.FS
+
+//skywalking:nocopy
+type Instrument struct {
+}
+
+func NewInstrument() *Instrument {
+       return &Instrument{}
+}
+
+func (i *Instrument) Name() string {
+       return "go-redisv9"
+}
+
+func (i *Instrument) BasePackage() string {
+       return "github.com/redis/go-redis/v9"
+}
+
+func (i *Instrument) VersionChecker(version string) bool {
+       return strings.HasPrefix(version, "v9.")
+}
+
+func (i *Instrument) Points() []*instrument.Point {
+       return []*instrument.Point{
+               {
+                       PackageName: "redis",
+                       PackagePath: "",
+                       At: 
instrument.NewStaticMethodEnhance("NewUniversalClient",
+                               instrument.WithArgsCount(1),
+                               instrument.WithArgType(0, "*UniversalOptions"),
+                               instrument.WithResultCount(1),
+                               instrument.WithResultType(0, 
"UniversalClient")),
+                       Interceptor: "GoRedisInterceptor",
+               },
+               {
+                       PackageName: "redis",
+                       PackagePath: "",
+                       At: instrument.NewStaticMethodEnhance("NewClient",
+                               instrument.WithArgsCount(1),
+                               instrument.WithArgType(0, "*Options"),
+                               instrument.WithResultCount(1),
+                               instrument.WithResultType(0, "*Client")),
+                       Interceptor: "GoRedisInterceptor",
+               },
+               {
+                       PackageName: "redis",
+                       PackagePath: "",
+                       At: 
instrument.NewStaticMethodEnhance("NewFailoverClient",
+                               instrument.WithArgsCount(1),
+                               instrument.WithArgType(0, "*FailoverOptions"),
+                               instrument.WithResultCount(1),
+                               instrument.WithResultType(0, "*Client")),
+                       Interceptor: "GoRedisInterceptor",
+               },
+               {
+                       PackageName: "redis",
+                       PackagePath: "",
+                       At: 
instrument.NewStaticMethodEnhance("NewClusterClient",
+                               instrument.WithArgsCount(1),
+                               instrument.WithArgType(0, "*ClusterOptions"),
+                               instrument.WithResultCount(1),
+                               instrument.WithResultType(0, "*ClusterClient")),
+                       Interceptor: "GoRedisInterceptor",
+               },
+               {
+                       PackageName: "redis",
+                       PackagePath: "",
+                       At: instrument.NewStaticMethodEnhance("NewRing",
+                               instrument.WithArgsCount(1),
+                               instrument.WithArgType(0, "*RingOptions"),
+                               instrument.WithResultCount(1),
+                               instrument.WithResultType(0, "*Ring")),
+                       Interceptor: "GoRedisInterceptor",
+               },
+       }
+}
+
+func (i *Instrument) FS() *embed.FS {
+       return &fs
+}
diff --git a/plugins/go-redisv9/intercepter.go 
b/plugins/go-redisv9/intercepter.go
new file mode 100644
index 0000000..98051b6
--- /dev/null
+++ b/plugins/go-redisv9/intercepter.go
@@ -0,0 +1,63 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package goredisv9
+
+import (
+       "fmt"
+
+       "github.com/apache/skywalking-go/plugins/core/operator"
+
+       redis "github.com/redis/go-redis/v9"
+)
+
+type GoRedisInterceptor struct {
+}
+
+// BeforeInvoke would be called before the target method invocation.
+func (g *GoRedisInterceptor) BeforeInvoke(invocation operator.Invocation) 
error {
+       return nil
+}
+
+// AfterInvoke would be called after the target method invocation.
+func (g *GoRedisInterceptor) AfterInvoke(invocation operator.Invocation, 
result ...interface{}) error {
+       rdb, ok := result[0].(redis.UniversalClient)
+       if !ok {
+               return fmt.Errorf("go-redis :skyWalking cannot create hook for 
client not match UniversalClient: %T", rdb)
+       }
+
+       switch c := rdb.(type) {
+       case *redis.Client:
+               c.AddHook(newRedisHook(c.Options().Addr))
+       case *redis.ClusterClient:
+               c.AddHook(newRedisHook(""))
+
+               c.OnNewNode(func(rdb *redis.Client) {
+                       rdb.AddHook(newRedisHook(rdb.Options().Addr))
+               })
+       case *redis.Ring:
+               c.AddHook(newRedisHook(""))
+
+               c.OnNewNode(func(rdb *redis.Client) {
+                       rdb.AddHook(newRedisHook(rdb.Options().Addr))
+               })
+       default:
+               return fmt.Errorf("go-redis :skyWalking cannot create hook for 
the unsupported client type: %T", c)
+       }
+
+       return nil
+}
diff --git a/plugins/go-redisv9/op_type.go b/plugins/go-redisv9/op_type.go
new file mode 100644
index 0000000..1a62389
--- /dev/null
+++ b/plugins/go-redisv9/op_type.go
@@ -0,0 +1,136 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package goredisv9
+
+const (
+       opTypeWrite   = "write"
+       opTypeRead    = "read"
+       opTypeUnknown = ""
+)
+
+// Commands are divided into different type.
+// Ref to JedisPluginConfig.java under skywalking-java repo
+
+var writeOperation = map[string]bool{
+       "getset":           true,
+       "set":              true,
+       "setbit":           true,
+       "setex":            true,
+       "setnx":            true,
+       "setrange":         true,
+       "strlen":           true,
+       "mset":             true,
+       "msetnx":           true,
+       "psetex":           true,
+       "incr":             true,
+       "incrby":           true,
+       "incrbyfloat":      true,
+       "decr":             true,
+       "decrby":           true,
+       "append":           true,
+       "hmset":            true,
+       "hset":             true,
+       "hsetnx":           true,
+       "hincrby":          true,
+       "hincrbyfloat":     true,
+       "hdel":             true,
+       "rpoplpush":        true,
+       "rpush":            true,
+       "rpushx":           true,
+       "lpush":            true,
+       "lpushx":           true,
+       "lrem":             true,
+       "ltrim":            true,
+       "lset":             true,
+       "brpoplpush":       true,
+       "linsert":          true,
+       "sadd":             true,
+       "sdiff":            true,
+       "sdiffstore":       true,
+       "sinterstore":      true,
+       "sismember":        true,
+       "srem":             true,
+       "sunion":           true,
+       "sunionstore":      true,
+       "sinter":           true,
+       "zadd":             true,
+       "zincrby":          true,
+       "zinterstore":      true,
+       "zrange":           true,
+       "zrangebylex":      true,
+       "zrangebyscore":    true,
+       "zrank":            true,
+       "zrem":             true,
+       "zremrangebylex":   true,
+       "zremrangebyrank":  true,
+       "zremrangebyscore": true,
+       "zrevrange":        true,
+       "zrevrangebyscore": true,
+       "zrevrank":         true,
+       "zunionstore":      true,
+       "xadd":             true,
+       "xdel":             true,
+       "del":              true,
+       "xtrim":            true,
+}
+
+var readOperation = map[string]bool{
+       "getrange":    true,
+       "getbit":      true,
+       "mget":        true,
+       "hvals":       true,
+       "hkeys":       true,
+       "hlen":        true,
+       "hexists":     true,
+       "hget":        true,
+       "hgetall":     true,
+       "hmget":       true,
+       "blpop":       true,
+       "brpop":       true,
+       "lindex":      true,
+       "llen":        true,
+       "lpop":        true,
+       "lrange":      true,
+       "rpop":        true,
+       "scard":       true,
+       "srandmember": true,
+       "spop":        true,
+       "sscan":       true,
+       "smove":       true,
+       "zlexcount":   true,
+       "zscore":      true,
+       "zscan":       true,
+       "zcard":       true,
+       "zcount":      true,
+       "xget":        true,
+       "get":         true,
+       "xread":       true,
+       "xlen":        true,
+       "xrange":      true,
+       "xrevrange":   true,
+}
+
+// getCacheOp return "read" or "write" or "" based on the cmd.
+func getCacheOp(cmd string) string {
+       if readOperation[cmd] {
+               return opTypeRead
+       } else if writeOperation[cmd] {
+               return opTypeWrite
+       }
+       return opTypeUnknown
+}
diff --git a/test/plugins/scenarios/go-redisv9/bin/startup.sh 
b/test/plugins/scenarios/go-redisv9/bin/startup.sh
new file mode 100755
index 0000000..05b2156
--- /dev/null
+++ b/test/plugins/scenarios/go-redisv9/bin/startup.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+home="$(cd "$(dirname $0)"; pwd)"
+go build ${GO_BUILD_OPTS} -o goredisv9
+
+./goredisv9
\ No newline at end of file
diff --git a/test/plugins/scenarios/go-redisv9/config/excepted.yml 
b/test/plugins/scenarios/go-redisv9/config/excepted.yml
new file mode 100644
index 0000000..ee03c5e
--- /dev/null
+++ b/test/plugins/scenarios/go-redisv9/config/excepted.yml
@@ -0,0 +1,101 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+segmentItems:
+  - serviceName: go-redisv9
+    segmentSize: ge 1
+    segments:
+      - segmentId: not null
+        spans:
+          - operationName: redis/set
+            parentSpanId: 0
+            spanId: 1
+            spanLayer: Cache
+            startTime: nq 0
+            endTime: nq 0
+            componentId: 5014
+            isError: false
+            spanType: Exit
+            peer: redis-server:6379
+            skipAnalysis: false
+            tags:
+              - {key: cache.type, value: redis}
+              - {key: cache.op, value: write}
+              - {key: cache.cmd, value: set}
+              - {key: cache.key, value: key_TestSetAndGet}
+              - {key: cache.args, value: not null}
+          - operationName: redis/get
+            parentSpanId: 0
+            spanId: 2
+            spanLayer: Cache
+            startTime: nq 0
+            endTime: nq 0
+            componentId: 5014
+            isError: false
+            spanType: Exit
+            peer: redis-server:6379
+            skipAnalysis: false
+            tags:
+              - {key: cache.type, value: redis}
+              - { key: cache.op, value: read}
+              - { key: cache.cmd, value: get}
+              - {key: cache.key, value: key_TestSetAndGet}
+              - { key: cache.args, value: not null}
+          - operationName: redis/pipeline
+            parentSpanId: 0
+            spanId: 3
+            spanLayer: Cache
+            startTime: nq 0
+            endTime: nq 0
+            componentId: 5014
+            isError: false
+            spanType: Exit
+            peer: redis-server:6379
+            skipAnalysis: false
+            tags:
+              - {key: cache.type, value: redis}
+              - {key: cache.cmd, value: 'pipeline:set/set'}
+          - operationName: redis/pipeline
+            parentSpanId: 0
+            spanId: 4
+            spanLayer: Cache
+            startTime: nq 0
+            endTime: nq 0
+            componentId: 5014
+            isError: false
+            spanType: Exit
+            peer: redis-server:6379
+            skipAnalysis: false
+            tags:
+              - {key: cache.type, value: redis}
+              - {key: cache.cmd, value: 'pipeline:get/get'}
+          - operationName: GET:/execute
+            parentSpanId: -1
+            spanId: 0
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: 5004
+            isError: false
+            spanType: Entry
+            peer: ''
+            skipAnalysis: false
+            tags:
+              - {key: http.method, value: GET}
+              - {key: url, value: 'service:8080/execute'}
+              - {key: status_code, value: '200'}
+meterItems: []
+logItems: []
diff --git a/test/plugins/scenarios/go-redisv9/go.mod 
b/test/plugins/scenarios/go-redisv9/go.mod
new file mode 100644
index 0000000..ef5a363
--- /dev/null
+++ b/test/plugins/scenarios/go-redisv9/go.mod
@@ -0,0 +1,24 @@
+module test/plugins/scenarios/go-redisv9
+
+go 1.19
+
+require (
+       github.com/apache/skywalking-go v0.1.0
+       github.com/redis/go-redis/v9 v9.0.5
+)
+
+require (
+       github.com/cespare/xxhash/v2 v2.2.0 // indirect
+       github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // 
indirect
+       github.com/golang/protobuf v1.5.3 // indirect
+       github.com/google/go-cmp v0.5.9 // indirect
+       github.com/google/uuid v1.3.0 // indirect
+       github.com/pkg/errors v0.9.1 // indirect
+       golang.org/x/net v0.10.0 // indirect
+       golang.org/x/sys v0.8.0 // indirect
+       golang.org/x/text v0.9.0 // indirect
+       google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // 
indirect
+       google.golang.org/grpc v1.55.0 // indirect
+       google.golang.org/protobuf v1.30.0 // indirect
+       skywalking.apache.org/repo/goapi v0.0.0-20230314034821-0c5a44bb767a // 
indirect
+)
diff --git a/test/plugins/scenarios/go-redisv9/go.sum 
b/test/plugins/scenarios/go-redisv9/go.sum
new file mode 100644
index 0000000..d00321d
--- /dev/null
+++ b/test/plugins/scenarios/go-redisv9/go.sum
@@ -0,0 +1,181 @@
+cloud.google.com/go v0.26.0/go.mod 
h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.34.0/go.mod 
h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/BurntSushi/toml v0.3.1/go.mod 
h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/OneOfOne/xxhash v1.2.2/go.mod 
h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
+github.com/antihax/optional v1.0.0/go.mod 
h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
+github.com/apache/skywalking-go v0.1.0 
h1:cgor9d4Wj0H6twjGtNvniraOSqjvovlqOdvsyhJo9kY=
+github.com/apache/skywalking-go v0.1.0/go.mod 
h1:r2FrabK/0XftMyosqre7WFZvZ1mEOVssJROo8xgcEW8=
+github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
+github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod 
h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/cespare/xxhash v1.1.0/go.mod 
h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
+github.com/cespare/xxhash/v2 v2.2.0 
h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
+github.com/cespare/xxhash/v2 v2.2.0/go.mod 
h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/client9/misspell v0.3.4/go.mod 
h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod 
h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
+github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod 
h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod 
h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/davecgh/go-spew v1.1.0/go.mod 
h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f 
h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod 
h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
+github.com/envoyproxy/go-control-plane v0.9.0/go.mod 
h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane 
v0.9.1-0.20191026205805-5f8ba28d4473/go.mod 
h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane v0.9.4/go.mod 
h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
+github.com/envoyproxy/go-control-plane 
v0.9.9-0.20201210154907-fd9021fe5dad/go.mod 
h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane 
v0.9.9-0.20210217033140-668b12f5399d/go.mod 
h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane 
v0.9.9-0.20210512163311-63b5d3c536b0/go.mod 
h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod 
h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/ghodss/yaml v1.0.0/go.mod 
h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod 
h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/mock v1.1.1/go.mod 
h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/protobuf v1.2.0/go.mod 
h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod 
h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.3/go.mod 
h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod 
h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod 
h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod 
h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod 
h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod 
h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod 
h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+github.com/golang/protobuf v1.4.2/go.mod 
h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.4.3/go.mod 
h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod 
h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.2/go.mod 
h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/golang/protobuf v1.5.3 
h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
+github.com/golang/protobuf v1.5.3/go.mod 
h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/google/go-cmp v0.2.0/go.mod 
h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod 
h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod 
h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod 
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0/go.mod 
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5/go.mod 
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.6/go.mod 
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
+github.com/google/go-cmp v0.5.9/go.mod 
h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/uuid v1.1.2/go.mod 
h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
+github.com/google/uuid v1.3.0/go.mod 
h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod 
h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod 
h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0/go.mod 
h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod 
h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/redis/go-redis/v9 v9.0.5 
h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl5o=
+github.com/redis/go-redis/v9 v9.0.5/go.mod 
h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
+github.com/rogpeppe/fastuuid v1.2.0/go.mod 
h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
+github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod 
h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
+github.com/stretchr/objx v0.1.0/go.mod 
h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.5.1/go.mod 
h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/yuin/goldmark v1.3.5/go.mod 
h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+github.com/yuin/goldmark v1.4.13/go.mod 
h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+go.opentelemetry.io/proto/otlp v0.7.0/go.mod 
h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod 
h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod 
h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod 
h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod 
h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod 
h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod 
h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod 
h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod 
h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod 
h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod 
h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod 
h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod 
h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod 
h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod 
h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod 
h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod 
h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod 
h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod 
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod 
h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod 
h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod 
h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod 
h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
+golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod 
h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod 
h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod 
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod 
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod 
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod 
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod 
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod 
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod 
h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod 
h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod 
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod 
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod 
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod 
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
+golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod 
h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod 
h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
+golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod 
h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod 
h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod 
h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod 
h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod 
h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod 
h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod 
h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.1.3/go.mod 
h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.12/go.mod 
h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod 
h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod 
h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod 
h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod 
h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/appengine v1.1.0/go.mod 
h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod 
h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod 
h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod 
h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod 
h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod 
h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
+google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod 
h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=
+google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 
h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
+google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod 
h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
+google.golang.org/grpc v1.19.0/go.mod 
h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.23.0/go.mod 
h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.25.1/go.mod 
h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
+google.golang.org/grpc v1.27.0/go.mod 
h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.33.1/go.mod 
h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
+google.golang.org/grpc v1.36.0/go.mod 
h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.38.0/go.mod 
h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.40.0/go.mod 
h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
+google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
+google.golang.org/grpc v1.55.0/go.mod 
h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod 
h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod 
h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod 
h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod 
h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod 
h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod 
h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.0/go.mod 
h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod 
h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.25.0/go.mod 
h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod 
h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0/go.mod 
h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+google.golang.org/protobuf v1.29.0/go.mod 
h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.30.0 
h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
+google.golang.org/protobuf v1.30.0/go.mod 
h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod 
h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod 
h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod 
h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+skywalking.apache.org/repo/goapi v0.0.0-20230314034821-0c5a44bb767a 
h1:m8DTnaSEOEnPXRWmA6g7isbdqw7WPZP6SnaEHz1Sx7s=
+skywalking.apache.org/repo/goapi v0.0.0-20230314034821-0c5a44bb767a/go.mod 
h1:LcZMcxDjdJPn5yetydFnxe0l7rmiv8lvHEnzRbsey14=
diff --git a/test/plugins/scenarios/go-redisv9/main.go 
b/test/plugins/scenarios/go-redisv9/main.go
new file mode 100644
index 0000000..fa09253
--- /dev/null
+++ b/test/plugins/scenarios/go-redisv9/main.go
@@ -0,0 +1,123 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+       "context"
+       "fmt"
+       "log"
+       "net/http"
+       "time"
+
+       v9 "github.com/redis/go-redis/v9"
+
+       _ "github.com/apache/skywalking-go"
+)
+
+var rdb *v9.Client
+
+type testFunc func(ctx context.Context) error
+
+func executeHandler(w http.ResponseWriter, r *http.Request) {
+       testCases := []struct {
+               name string
+               fn   testFunc
+       }{
+               {"set_and_get", TestSetAndGet},
+               {"pipeline_set_and_get", TestPipelineSetAndGet},
+       }
+
+       for _, test := range testCases {
+               log.Printf("excute test case %s", test.name)
+               if err := test.fn(r.Context()); err != nil {
+                       log.Fatalf("test case %s failed: %v", test.name, err)
+               }
+       }
+       _, _ = w.Write([]byte("execute redis op success"))
+}
+
+func TestSetAndGet(ctx context.Context) error {
+       key := "key_TestSetAndGet"
+       value := "value_TestSetAndGet"
+       if _, err := rdb.Set(ctx, key, value, 10*time.Second).Result(); err != 
nil {
+               return fmt.Errorf("SET error: %s", err.Error())
+       }
+
+       if v, err := rdb.Get(ctx, key).Result(); err != nil || v != value {
+               return fmt.Errorf("GET error: %s", err.Error())
+       }
+
+       return nil
+}
+
+func TestPipelineSetAndGet(ctx context.Context) error {
+       key1 := "key_TestPipelineSetAndGet_1"
+       value1 := "value_TestPipelineSetAndGet_1"
+
+       key2 := "key_TestPipelineSetAndGet_2"
+       value2 := "value_TestPipelineSetAndGet_2"
+
+       pipe := rdb.Pipeline()
+
+       pipe.Set(ctx, key1, value1, 0)
+       pipe.Set(ctx, key2, value2, 0)
+
+       _, err := pipe.Exec(ctx)
+       if err != nil {
+               return fmt.Errorf("pipeline SET error: %s", err.Error())
+       }
+
+       pipe = rdb.Pipeline()
+
+       pipe.Get(ctx, key1)
+       pipe.Get(ctx, key2)
+
+       cmds, err := pipe.Exec(ctx)
+       if err != nil {
+               return fmt.Errorf("pipeline SET error: %s", err.Error())
+       }
+
+       for _, cmd := range cmds {
+               if _, ok := cmd.(*v9.StringCmd); !ok {
+                       return fmt.Errorf("pipeline GET response not StringCmd 
type")
+               }
+       }
+       return nil
+}
+
+func main() {
+       c := v9.NewClient(&v9.Options{
+               Addr:     "redis-server:6379",
+               Password: "",
+       })
+
+       _, err := c.Ping(context.TODO()).Result()
+       if err != nil {
+               log.Fatalf("connect to redis error: %v \n", err)
+       }
+
+       rdb = c
+
+       http.HandleFunc("/execute", executeHandler)
+
+       http.HandleFunc("/health", func(writer http.ResponseWriter, request 
*http.Request) {
+               writer.WriteHeader(http.StatusOK)
+       })
+
+       _ = http.ListenAndServe(":8080", nil)
+}
diff --git a/test/plugins/scenarios/go-redisv9/plugin.yml 
b/test/plugins/scenarios/go-redisv9/plugin.yml
new file mode 100644
index 0000000..6f90b33
--- /dev/null
+++ b/test/plugins/scenarios/go-redisv9/plugin.yml
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+entry-service: http://${HTTP_HOST}:${HTTP_PORT}/execute
+health-checker: http://${HTTP_HOST}:${HTTP_PORT}/health
+start-script: ./bin/startup.sh
+framework: github.com/redis/go-redis/v9
+export-port: 8080
+support-version:
+  - go: 1.17
+    framework:
+      - v9.0.3
+  - go: 1.18
+    framework:
+      - v9.0.4
+      - v9.0.5
+dependencies:
+  redis-server:
+    image: redis:6.2
+    hostname: redis-server
+    expose:
+      - "6379"
+    healthcheck:
+      test: ["CMD", "redis-cli", "-h", "localhost", "ping"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
\ No newline at end of file
diff --git a/tools/go-agent/instrument/plugins/register.go 
b/tools/go-agent/instrument/plugins/register.go
index efba2a0..c9359fb 100644
--- a/tools/go-agent/instrument/plugins/register.go
+++ b/tools/go-agent/instrument/plugins/register.go
@@ -21,6 +21,7 @@ import (
        "github.com/apache/skywalking-go/plugins/core/instrument"
        "github.com/apache/skywalking-go/plugins/dubbo"
        "github.com/apache/skywalking-go/plugins/gin"
+       goredisv9 "github.com/apache/skywalking-go/plugins/go-redisv9"
        "github.com/apache/skywalking-go/plugins/go-restfulv3"
        gorm_entry "github.com/apache/skywalking-go/plugins/gorm/entry"
        gorm_mysql "github.com/apache/skywalking-go/plugins/gorm/mysql"
@@ -39,6 +40,7 @@ func init() {
        registerFramework(restfulv3.NewInstrument())
        registerFramework(kratosv2.NewInstrument())
        registerFramework(microv4.NewInstrument())
+       registerFramework(goredisv9.NewInstrument())
 
        // gorm related instruments
        registerFramework(gorm_entry.NewInstrument())

Reply via email to