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 2023/08/04 11:27:14 UTC
[skywalking-go] branch main updated: Add Mux framework support (#87)
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 e5fbe62 Add Mux framework support (#87)
e5fbe62 is described below
commit e5fbe621422056c1da8dd3e7389b014decbac5ac
Author: mrproliu <74...@qq.com>
AuthorDate: Fri Aug 4 19:27:09 2023 +0800
Add Mux framework support (#87)
---
.github/workflows/plugin-tests.yaml | 1 +
CHANGES.md | 15 +++++
docs/en/agent/support-plugins.md | 1 +
go.work | 2 +
plugins/mux/go.mod | 5 ++
plugins/mux/go.sum | 2 +
plugins/mux/instrument.go | 72 ++++++++++++++++++++
plugins/mux/match_interceptor.go | 73 ++++++++++++++++++++
plugins/mux/serve_interceptor.go | 70 ++++++++++++++++++++
plugins/mux/structures.go | 37 +++++++++++
.../plugins/scenarios/kratosv2/config/excepted.yml | 8 ++-
test/plugins/scenarios/mux/bin/startup.sh | 22 +++++++
test/plugins/scenarios/mux/config/excepted.yml | 77 ++++++++++++++++++++++
test/plugins/scenarios/mux/go.mod | 5 ++
test/plugins/scenarios/mux/go.sum | 2 +
test/plugins/scenarios/mux/main.go | 65 ++++++++++++++++++
test/plugins/scenarios/mux/plugin.yml | 31 +++++++++
tools/go-agent/instrument/plugins/register.go | 2 +
18 files changed, 487 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/plugin-tests.yaml b/.github/workflows/plugin-tests.yaml
index 714d805..41fbefa 100644
--- a/.github/workflows/plugin-tests.yaml
+++ b/.github/workflows/plugin-tests.yaml
@@ -83,6 +83,7 @@ jobs:
- logrus
- plugin_exclusion
- runtime_metrics
+ - mux
steps:
- uses: actions/checkout@v2
with:
diff --git a/CHANGES.md b/CHANGES.md
index d12a4f0..03ca72d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,21 @@ Changes by Version
==================
Release Notes.
+0.3.0
+------------------
+#### Features
+
+#### Plugins
+* Support [mux](https://github.com/gorilla/mux) HTTP server framework.
+
+#### Documentation
+
+#### Bug Fixes
+
+#### Issues and PR
+- All issues are [here](https://github.com/apache/skywalking/milestone/189?closed=1)
+- All and pull requests are [here](https://github.com/apache/skywalking-go/milestone/3?closed=1)
+
0.2.0
------------------
#### Features
diff --git a/docs/en/agent/support-plugins.md b/docs/en/agent/support-plugins.md
index 35622d1..24e2362 100644
--- a/docs/en/agent/support-plugins.md
+++ b/docs/en/agent/support-plugins.md
@@ -6,6 +6,7 @@ metrics based on the tracing data.
* `gin`: [Gin](https://github.com/gin-gonic/gin) tested v1.7.0 to v1.9.0.
* `http`: [Native HTTP](https://pkg.go.dev/net/http) tested go v1.17 to go v1.20.
* `go-restfulv3`: [Go-Restful](https://github.com/emicklei/go-restful) tested v3.7.1 to 3.10.2.
+ * `mux`: [Mux](https://github.com/gorilla/mux) tested v1.7.0 to v1.8.0.
* HTTP Client
* `http`: [Native HTTP](https://pkg.go.dev/net/http) tested go v1.17 to go v1.20.
* RPC Frameworks
diff --git a/go.work b/go.work
index a2d1d46..9f01884 100644
--- a/go.work
+++ b/go.work
@@ -16,6 +16,7 @@ use (
./plugins/mongo
./plugins/sql
./plugins/runtimemetrics
+ ./plugins/mux
./test/benchmark-codebase/consumer
./test/benchmark-codebase/provider
@@ -35,6 +36,7 @@ use (
./test/plugins/scenarios/mysql
./test/plugins/scenarios/logrus
./test/plugins/scenarios/zap
+ ./test/plugins/scenarios/mux
./test/plugins/scenarios/plugin_exclusion
./test/plugins/scenarios/runtime_metrics
diff --git a/plugins/mux/go.mod b/plugins/mux/go.mod
new file mode 100644
index 0000000..f66f9bc
--- /dev/null
+++ b/plugins/mux/go.mod
@@ -0,0 +1,5 @@
+module github.com/apache/skywalking-go/plugins/mux
+
+go 1.18
+
+require github.com/gorilla/mux v1.8.0 // indirect
diff --git a/plugins/mux/go.sum b/plugins/mux/go.sum
new file mode 100644
index 0000000..5350288
--- /dev/null
+++ b/plugins/mux/go.sum
@@ -0,0 +1,2 @@
+github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
+github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
diff --git a/plugins/mux/instrument.go b/plugins/mux/instrument.go
new file mode 100644
index 0000000..5c5fd95
--- /dev/null
+++ b/plugins/mux/instrument.go
@@ -0,0 +1,72 @@
+// 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 mux
+
+import (
+ "embed"
+
+ "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 "mux"
+}
+
+func (i *Instrument) BasePackage() string {
+ return "github.com/gorilla/mux"
+}
+
+func (i *Instrument) VersionChecker(version string) bool {
+ return true
+}
+
+func (i *Instrument) Points() []*instrument.Point {
+ return []*instrument.Point{
+ {
+ PackagePath: "",
+ At: instrument.NewMethodEnhance("*Router", "ServeHTTP",
+ instrument.WithArgsCount(2),
+ instrument.WithArgType(0, "http.ResponseWriter"), instrument.WithArgType(1, "*http.Request"),
+ instrument.WithResultCount(0)),
+ Interceptor: "ServeHTTPInterceptor",
+ },
+ {
+ PackagePath: "",
+ At: instrument.NewMethodEnhance("*Router", "Match",
+ instrument.WithArgsCount(2),
+ instrument.WithArgType(0, "*http.Request"), instrument.WithArgType(1, "*RouteMatch"),
+ instrument.WithResultCount(1), instrument.WithResultType(0, "bool")),
+ Interceptor: "MatchInterceptor",
+ },
+ }
+}
+
+func (i *Instrument) FS() *embed.FS {
+ return &fs
+}
diff --git a/plugins/mux/match_interceptor.go b/plugins/mux/match_interceptor.go
new file mode 100644
index 0000000..02625c2
--- /dev/null
+++ b/plugins/mux/match_interceptor.go
@@ -0,0 +1,73 @@
+// 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 mux
+
+import (
+ "net/http"
+
+ "github.com/apache/skywalking-go/plugins/core/operator"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+)
+
+type MatchInterceptor struct {
+}
+
+func (n *MatchInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+ return nil
+}
+
+func (n *MatchInterceptor) AfterInvoke(invocation operator.Invocation, results ...interface{}) error {
+ // only process with matched route
+ if matched, ok := results[0].(bool); !ok || !matched {
+ return nil
+ }
+ match, ok := invocation.Args()[1].(*RouteMatch)
+ req := invocation.Args()[0].(*http.Request)
+ if !ok || match == nil || match.Route == nil || req == nil {
+ return nil
+ }
+
+ span := tracing.ActiveSpan()
+ if span == nil {
+ return nil
+ }
+
+ // find matched template
+ var routePrefix, routePath string
+ for _, matcher := range match.Route.matchers {
+ if regexp, ok := matcher.(*routeRegexp); ok && regexp != nil {
+ if regexp.regexpType == 2 {
+ routePrefix = regexp.template
+ } else if regexp.regexpType == 0 {
+ routePath = regexp.template
+ }
+ }
+ }
+
+ opName := routePrefix
+ if routePath != "" {
+ opName = routePath
+ }
+
+ // re-set the operation name if route path/prefix not empty
+ if opName != "" {
+ span.SetOperationName(req.Method + ":" + opName)
+ }
+
+ return nil
+}
diff --git a/plugins/mux/serve_interceptor.go b/plugins/mux/serve_interceptor.go
new file mode 100644
index 0000000..7078d08
--- /dev/null
+++ b/plugins/mux/serve_interceptor.go
@@ -0,0 +1,70 @@
+// 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 mux
+
+import (
+ "fmt"
+ "net/http"
+
+ "github.com/apache/skywalking-go/plugins/core/operator"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+)
+
+type ServeHTTPInterceptor struct {
+}
+
+func (n *ServeHTTPInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+ request := invocation.Args()[1].(*http.Request)
+ s, err := tracing.CreateEntrySpan(fmt.Sprintf("%s:%s", request.Method, request.RequestURI), func(headerKey string) (string, error) {
+ return request.Header.Get(headerKey), nil
+ }, tracing.WithLayer(tracing.SpanLayerHTTP),
+ tracing.WithComponent(5017),
+ tracing.WithTag(tracing.TagHTTPMethod, request.Method),
+ tracing.WithTag(tracing.TagURL, request.Host+request.URL.Path))
+ if err != nil {
+ return err
+ }
+
+ writer := invocation.Args()[0].(http.ResponseWriter)
+ invocation.ChangeArg(0, &writerWrapper{ResponseWriter: writer, statusCode: http.StatusOK})
+ invocation.SetContext(s)
+ return nil
+}
+
+func (n *ServeHTTPInterceptor) AfterInvoke(invocation operator.Invocation, results ...interface{}) error {
+ if invocation.GetContext() == nil {
+ return nil
+ }
+ span := invocation.GetContext().(tracing.Span)
+ if wrapped, ok := invocation.Args()[0].(*writerWrapper); ok {
+ span.Tag(tracing.TagStatusCode, fmt.Sprintf("%d", wrapped.statusCode))
+ }
+ span.End()
+ return nil
+}
+
+type writerWrapper struct {
+ http.ResponseWriter
+ statusCode int
+}
+
+func (w *writerWrapper) WriteHeader(statusCode int) {
+ // cache the status code
+ w.statusCode = statusCode
+ w.ResponseWriter.WriteHeader(statusCode)
+}
diff --git a/plugins/mux/structures.go b/plugins/mux/structures.go
new file mode 100644
index 0000000..dd68c2e
--- /dev/null
+++ b/plugins/mux/structures.go
@@ -0,0 +1,37 @@
+// 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 mux
+
+//skywalking:native github.com/gorilla/mux RouteMatch
+type RouteMatch struct {
+ Route *Route
+}
+
+type Route struct {
+ routeConf
+}
+
+type routeConf struct {
+ matchers []interface{}
+}
+
+//skywalking:native github.com/gorilla/mux routeRegexp
+type routeRegexp struct {
+ template string
+ regexpType int
+}
diff --git a/test/plugins/scenarios/kratosv2/config/excepted.yml b/test/plugins/scenarios/kratosv2/config/excepted.yml
index acc57e7..90e0ac4 100644
--- a/test/plugins/scenarios/kratosv2/config/excepted.yml
+++ b/test/plugins/scenarios/kratosv2/config/excepted.yml
@@ -23,16 +23,18 @@ segmentItems:
- operationName: /helloworld.Greeter/SayHello
parentSpanId: -1
spanId: 0
- spanLayer: RPCFramework
+ spanLayer: Http
startTime: nq 0
endTime: nq 0
- componentId: 5010
+ componentId: 5017
isError: false
spanType: Entry
peer: ''
skipAnalysis: false
tags:
- - {key: transport, value: HTTP}
+ - { key: http.method, value: GET }
+ - { key: url, value: 'localhost:8000/helloworld/test' }
+ - {key: status_code, value: '200'}
refs:
- {parentEndpoint: 'GET:/consumer', networkAddress: 'localhost:8000', refType: CrossProcess,
parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null,
diff --git a/test/plugins/scenarios/mux/bin/startup.sh b/test/plugins/scenarios/mux/bin/startup.sh
new file mode 100755
index 0000000..82397eb
--- /dev/null
+++ b/test/plugins/scenarios/mux/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 mux
+
+./mux
\ No newline at end of file
diff --git a/test/plugins/scenarios/mux/config/excepted.yml b/test/plugins/scenarios/mux/config/excepted.yml
new file mode 100644
index 0000000..43b2361
--- /dev/null
+++ b/test/plugins/scenarios/mux/config/excepted.yml
@@ -0,0 +1,77 @@
+# 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: mux
+ segmentSize: ge 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: GET:/provider/test
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 5005
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ skipAnalysis: false
+ tags:
+ - { key: http.method, value: GET }
+ - { key: url, value: 'localhost:8080/provider/test' }
+ - { key: status_code, value: '200' }
+ - operationName: GET:/consumer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 5017
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - { key: http.method, value: GET }
+ - { key: url, value: 'service:8080/consumer' }
+ - { key: status_code, value: '200' }
+ - segmentId: not null
+ spans:
+ - operationName: GET:/provider/{var}
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 5017
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - { key: http.method, value: GET }
+ - { key: url, value: 'localhost:8080/provider/test' }
+ - { key: status_code, value: '200' }
+ refs:
+ - { parentEndpoint: GET:/consumer, networkAddress: 'localhost:8080', refType: CrossProcess,
+ parentSpanId: 1, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: mux,
+ traceId: not null }
+
+meterItems: []
+logItems: []
\ No newline at end of file
diff --git a/test/plugins/scenarios/mux/go.mod b/test/plugins/scenarios/mux/go.mod
new file mode 100644
index 0000000..7551e44
--- /dev/null
+++ b/test/plugins/scenarios/mux/go.mod
@@ -0,0 +1,5 @@
+module test/plugins/scenarios/mux
+
+go 1.18
+
+require github.com/gorilla/mux v1.8.0 // indirect
diff --git a/test/plugins/scenarios/mux/go.sum b/test/plugins/scenarios/mux/go.sum
new file mode 100644
index 0000000..5350288
--- /dev/null
+++ b/test/plugins/scenarios/mux/go.sum
@@ -0,0 +1,2 @@
+github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
+github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
diff --git a/test/plugins/scenarios/mux/main.go b/test/plugins/scenarios/mux/main.go
new file mode 100644
index 0000000..464d463
--- /dev/null
+++ b/test/plugins/scenarios/mux/main.go
@@ -0,0 +1,65 @@
+// 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 (
+ "io"
+ "log"
+ "net/http"
+ "time"
+
+ _ "github.com/apache/skywalking-go"
+
+ "github.com/gorilla/mux"
+)
+
+func provider(w http.ResponseWriter, r *http.Request) {
+ time.Sleep(time.Millisecond * 10)
+ w.Write([]byte("success"))
+}
+
+func consumer(w http.ResponseWriter, r *http.Request) {
+ resp, err := http.Get("http://localhost:8080/provider/test?test=1")
+ if err != nil {
+ log.Printf("request provider error: %v", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ defer resp.Body.Close()
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ log.Print(err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ _, _ = w.Write(body)
+}
+
+func health(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte("success"))
+}
+
+func main() {
+ r := mux.NewRouter()
+ r.Path("/health").HandlerFunc(health)
+ r.Path("/consumer").HandlerFunc(consumer)
+ r.PathPrefix("/provider").Path("/{var}").HandlerFunc(provider)
+
+ // Bind to a port and pass our router in
+ log.Fatal(http.ListenAndServe(":8080", r))
+}
diff --git a/test/plugins/scenarios/mux/plugin.yml b/test/plugins/scenarios/mux/plugin.yml
new file mode 100644
index 0000000..9860d6e
--- /dev/null
+++ b/test/plugins/scenarios/mux/plugin.yml
@@ -0,0 +1,31 @@
+# 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}/consumer
+health-checker: http://${HTTP_HOST}:${HTTP_PORT}/health
+start-script: ./bin/startup.sh
+framework: github.com/gorilla/mux
+export-port: 8080
+support-version:
+ - go: 1.18
+ framework:
+ - v1.7.0
+ - v1.7.1
+ - v1.7.2
+ - v1.7.3
+ - v1.7.4
+ - v1.8.0
+dependencies:
\ 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 7cb9a49..658947e 100644
--- a/tools/go-agent/instrument/plugins/register.go
+++ b/tools/go-agent/instrument/plugins/register.go
@@ -29,6 +29,7 @@ import (
"github.com/apache/skywalking-go/plugins/kratosv2"
"github.com/apache/skywalking-go/plugins/microv4"
"github.com/apache/skywalking-go/plugins/mongo"
+ "github.com/apache/skywalking-go/plugins/mux"
runtime_metrics "github.com/apache/skywalking-go/plugins/runtimemetrics"
sql_entry "github.com/apache/skywalking-go/plugins/sql/entry"
sql_mysql "github.com/apache/skywalking-go/plugins/sql/mysql"
@@ -47,6 +48,7 @@ func init() {
registerFramework(goredisv9.NewInstrument())
registerFramework(mongo.NewInstrument())
registerFramework(runtime_metrics.NewInstrument())
+ registerFramework(mux.NewInstrument())
// gorm related instruments
registerFramework(gorm_entry.NewInstrument())