From 0f9079e84f2d894826c48db809c65c90507c0b32 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Wed, 18 Sep 2024 17:55:59 +0800 Subject: [PATCH 01/20] feat:add support goframe v2 --- go.work | 1 + go.work.sum | 2 + plugins/goframe/go.mod | 11 +++ plugins/goframe/go.sum | 13 ++++ plugins/goframe/instrument.go | 46 +++++++++++++ plugins/goframe/net/ghttp/intercepter.go | 68 +++++++++++++++++++ tools/go-agent/instrument/plugins/register.go | 4 ++ 7 files changed, 145 insertions(+) create mode 100644 plugins/goframe/go.mod create mode 100644 plugins/goframe/go.sum create mode 100644 plugins/goframe/instrument.go create mode 100644 plugins/goframe/net/ghttp/intercepter.go diff --git a/go.work b/go.work index 3d617e98..07e3265d 100644 --- a/go.work +++ b/go.work @@ -28,6 +28,7 @@ use ( ./plugins/pulsar ./plugins/segmentio-kafka ./plugins/go-elasticsearchv8 + ./plugins/goframe ./test/benchmark-codebase/consumer ./test/benchmark-codebase/provider diff --git a/go.work.sum b/go.work.sum index 7cc8ade2..2244c99c 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1543,6 +1543,8 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a h1:AhmOdSHeswKHBjh github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= diff --git a/plugins/goframe/go.mod b/plugins/goframe/go.mod new file mode 100644 index 00000000..2d0a618d --- /dev/null +++ b/plugins/goframe/go.mod @@ -0,0 +1,11 @@ +module github.com/apache/skywalking-go/plugins/goframe + +go 1.19 + +require github.com/apache/skywalking-go/plugins/core v0.0.0-20240910044646-4f94a255c2d3 + +require ( + github.com/dave/dst v0.27.2 // indirect + github.com/stretchr/testify v1.9.0 // indirect + golang.org/x/sys v0.20.0 // indirect +) diff --git a/plugins/goframe/go.sum b/plugins/goframe/go.sum new file mode 100644 index 00000000..c5cae912 --- /dev/null +++ b/plugins/goframe/go.sum @@ -0,0 +1,13 @@ +github.com/apache/skywalking-go/plugins/core v0.0.0-20240910044646-4f94a255c2d3 h1:eU6k2oVqIeHt0qoExrP5OsvNF3+29dXBR9DFVJS56hM= +github.com/apache/skywalking-go/plugins/core v0.0.0-20240910044646-4f94a255c2d3/go.mod h1:5a8UbX22PEo+7u7aPvGyNVDPkkJHM//nZwrnk7TDXIM= +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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/plugins/goframe/instrument.go b/plugins/goframe/instrument.go new file mode 100644 index 00000000..cf230418 --- /dev/null +++ b/plugins/goframe/instrument.go @@ -0,0 +1,46 @@ +package goframe + +import ( + "embed" + "github.com/apache/skywalking-go/plugins/core/instrument" + "strings" +) + +//go:embed * +var fs embed.FS + +//skywalking:nocopy +type Instrument struct { +} + +func NewInstrument() *Instrument { + return &Instrument{} +} + +func (i *Instrument) Name() string { + return "goframe" +} + +func (i *Instrument) BasePackage() string { + return "github.com/gogf/gf/v2" +} + +func (i *Instrument) VersionChecker(version string) bool { + return strings.HasPrefix(version, "v2.") +} + +func (i *Instrument) Points() []*instrument.Point { + return []*instrument.Point{ + { + PackagePath: "net/ghttp", + At: instrument.NewMethodEnhance("*Server", "ServeHTTP", + instrument.WithArgsCount(2), instrument.WithArgType(0, "http.ResponseWriter"), + instrument.WithArgType(1, "*http.Request")), + Interceptor: "GoFrameServerInterceptor", + }, + } +} + +func (i *Instrument) FS() *embed.FS { + return &fs +} diff --git a/plugins/goframe/net/ghttp/intercepter.go b/plugins/goframe/net/ghttp/intercepter.go new file mode 100644 index 00000000..a650f9bc --- /dev/null +++ b/plugins/goframe/net/ghttp/intercepter.go @@ -0,0 +1,68 @@ +// 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 ghttp + +import ( + "fmt" + "github.com/apache/skywalking-go/plugins/core/operator" + "github.com/apache/skywalking-go/plugins/core/tracing" + "net/http" +) + +// GoFrameServerInterceptor is used to intercept and trace HTTP requests. +type GoFrameServerInterceptor struct{} + +// BeforeInvoke intercepts the HTTP request before invoking the handler. +func (h *GoFrameServerInterceptor) BeforeInvoke(invocation operator.Invocation) error { + request := invocation.Args()[1].(*http.Request) + s, err := tracing.CreateEntrySpan(fmt.Sprintf("%s:%s", request.Method, request.URL.Path), func(headerKey string) (string, error) { + return request.Header.Get(headerKey), nil + }, tracing.WithLayer(tracing.SpanLayerHTTP), + tracing.WithTag(tracing.TagHTTPMethod, request.Method), + tracing.WithTag(tracing.TagURL, request.Host+request.URL.Path), + tracing.WithComponent(5004)) + if err != nil { + return err + } + + s.Tag(tracing.TagHTTPParams, request.URL.RawQuery) + + writer := invocation.Args()[0].(http.ResponseWriter) + invocation.ChangeArg(0, &writerWrapper{ResponseWriter: writer, statusCode: http.StatusOK}) + invocation.SetContext(s) + return nil +} + +// AfterInvoke processes after the HTTP request has been handled. +func (h *GoFrameServerInterceptor) AfterInvoke(invocation operator.Invocation, result ...interface{}) error { + fmt.Printf("goframe 拦截请求前 AfterInvoke\n") + 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 +} diff --git a/tools/go-agent/instrument/plugins/register.go b/tools/go-agent/instrument/plugins/register.go index f791ca95..dd17021a 100644 --- a/tools/go-agent/instrument/plugins/register.go +++ b/tools/go-agent/instrument/plugins/register.go @@ -30,6 +30,7 @@ import ( goelasticsearchv8 "github.com/apache/skywalking-go/plugins/go-elasticsearchv8" goredisv9 "github.com/apache/skywalking-go/plugins/go-redisv9" "github.com/apache/skywalking-go/plugins/go-restfulv3" + "github.com/apache/skywalking-go/plugins/goframe" gorm_entry "github.com/apache/skywalking-go/plugins/gorm/entry" gorm_mysql "github.com/apache/skywalking-go/plugins/gorm/mysql" "github.com/apache/skywalking-go/plugins/grpc" @@ -85,6 +86,9 @@ func init() { // echov4 related instruments registerFramework(echov4.NewInstrument()) + + //goframe + registerFramework(goframe.NewInstrument()) } func registerFramework(ins instrument.Instrument) { From 8aee42383511a84326ef42f42404f5616ad1d962 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Wed, 18 Sep 2024 18:15:00 +0800 Subject: [PATCH 02/20] feat: add License head --- plugins/goframe/instrument.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/goframe/instrument.go b/plugins/goframe/instrument.go index cf230418..32b1a23d 100644 --- a/plugins/goframe/instrument.go +++ b/plugins/goframe/instrument.go @@ -1,3 +1,20 @@ +// 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 goframe import ( From 3ad37c5919effd1d04fec8c95c0d9e1e7d25e7f1 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Wed, 18 Sep 2024 18:34:17 +0800 Subject: [PATCH 03/20] fix:format nolint and remove mod require --- plugins/goframe/go.mod | 2 -- plugins/goframe/instrument.go | 1 + plugins/goframe/net/ghttp/intercepter.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/goframe/go.mod b/plugins/goframe/go.mod index 2d0a618d..88db9d33 100644 --- a/plugins/goframe/go.mod +++ b/plugins/goframe/go.mod @@ -2,8 +2,6 @@ module github.com/apache/skywalking-go/plugins/goframe go 1.19 -require github.com/apache/skywalking-go/plugins/core v0.0.0-20240910044646-4f94a255c2d3 - require ( github.com/dave/dst v0.27.2 // indirect github.com/stretchr/testify v1.9.0 // indirect diff --git a/plugins/goframe/instrument.go b/plugins/goframe/instrument.go index 32b1a23d..eab2e7c8 100644 --- a/plugins/goframe/instrument.go +++ b/plugins/goframe/instrument.go @@ -17,6 +17,7 @@ package goframe +//go:nolint import ( "embed" "github.com/apache/skywalking-go/plugins/core/instrument" diff --git a/plugins/goframe/net/ghttp/intercepter.go b/plugins/goframe/net/ghttp/intercepter.go index a650f9bc..e8dfe596 100644 --- a/plugins/goframe/net/ghttp/intercepter.go +++ b/plugins/goframe/net/ghttp/intercepter.go @@ -17,6 +17,7 @@ package ghttp +//go:nolint import ( "fmt" "github.com/apache/skywalking-go/plugins/core/operator" @@ -50,7 +51,6 @@ func (h *GoFrameServerInterceptor) BeforeInvoke(invocation operator.Invocation) // AfterInvoke processes after the HTTP request has been handled. func (h *GoFrameServerInterceptor) AfterInvoke(invocation operator.Invocation, result ...interface{}) error { - fmt.Printf("goframe 拦截请求前 AfterInvoke\n") if invocation.GetContext() == nil { return nil } From 865cd329b7df4081f02c9513cf4a7853496812b5 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Wed, 18 Sep 2024 18:37:34 +0800 Subject: [PATCH 04/20] feat:CHANGES.md update --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 3b552a6d..e0fbfc33 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,8 +8,10 @@ Release Notes. * support attaching events to span in the toolkit. * support record log in the toolkit. +* support goframev2 #### Plugins +* Support [goframev2](https://github.com/gogf/gf) goframev2. #### Bug Fixes * Fix wrong docker image name and `-version` command. From bf823fb88f094d9dbab3fbae69d8da93628d0b45 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Wed, 18 Sep 2024 19:06:17 +0800 Subject: [PATCH 05/20] feat:add scenarios Plugin test --- go.work | 1 + go.work.sum | 11 +- plugins/goframe/net/ghttp/intercepter_test.go | 73 ++++++ test/plugins/scenarios/goframe/bin/startup.sh | 22 ++ .../scenarios/goframe/config/excepted.yml | 68 ++++++ test/plugins/scenarios/goframe/go.mod | 40 ++++ test/plugins/scenarios/goframe/go.sum | 219 ++++++++++++++++++ test/plugins/scenarios/goframe/main.go | 51 ++++ test/plugins/scenarios/goframe/plugin.yml | 28 +++ 9 files changed, 508 insertions(+), 5 deletions(-) create mode 100644 plugins/goframe/net/ghttp/intercepter_test.go create mode 100755 test/plugins/scenarios/goframe/bin/startup.sh create mode 100644 test/plugins/scenarios/goframe/config/excepted.yml create mode 100644 test/plugins/scenarios/goframe/go.mod create mode 100644 test/plugins/scenarios/goframe/go.sum create mode 100644 test/plugins/scenarios/goframe/main.go create mode 100644 test/plugins/scenarios/goframe/plugin.yml diff --git a/go.work b/go.work index 07e3265d..a3835edf 100644 --- a/go.work +++ b/go.work @@ -69,4 +69,5 @@ use ( ./tools/go-agent ./toolkit + test/plugins/scenarios/goframe ) diff --git a/go.work.sum b/go.work.sum index 2244c99c..6451f8e1 100644 --- a/go.work.sum +++ b/go.work.sum @@ -904,8 +904,6 @@ github.com/go-kratos/swagger-api v1.0.0 h1:R1JcAqLSvfDzqHoDnpK3Jt1MEJAXGNifV7AnB github.com/go-ldap/ldap v3.0.2+incompatible h1:kD5HQcAzlQ7yrhfn+h+MSABeAy/jAJhvIJ/QDllP44g= github.com/go-ldap/ldap/v3 v3.1.10 h1:7WsKqasmPThNvdl0Q5GPpbTDD/ZD98CfuawrMIuh7qQ= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-micro/plugins/v4/auth/jwt v1.2.0 h1:+dJHFnobRhX3QvTlHKCj5Sn2eeFsfNFzmFCc4HX5ULQ= github.com/go-micro/plugins/v4/auth/jwt v1.2.0/go.mod h1:6tHH9WrpbEwmNQKJj8DutZtZdvY9gl0XBRJPnzEwl6Q= github.com/go-micro/plugins/v4/broker/nats v1.1.0 h1:JCo2JksH0M6HC8q8L+x9QCqGRr5M0BADQw2Q50TWCas= @@ -1223,7 +1221,6 @@ github.com/lyft/protoc-gen-validate v0.0.13 h1:KNt/RhmQTOLr7Aj8PsJ7mTronaFyx80mR github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/marstr/guid v1.1.0 h1:/M4H/1G4avsieL6BbUwCOBzulmoeKVP5ux/3mQNnbyI= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= @@ -1238,7 +1235,6 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.6 h1:9Jok5pILi5S1MnDirGVTufYGtksUs/V2BWUP3ZkeUUI= github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= @@ -1356,7 +1352,6 @@ github.com/oklog/oklog v0.3.2 h1:wVfs8F+in6nTBMkA7CbRw+zZMIB7nNM825cM1wuzoTk= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5 h1:58+kh9C6jJVXYjt8IE48G2eWl6BjwU5Gj0gqY84fy78= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 h1:Yl0tPBa8QPjGmesFh1D0rDy+q1Twx6FyU7VWHi8wZbI= github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -1697,6 +1692,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4 h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 h1:FR+oGxGfbQu1d+jglI3rCkjAjUnhRSZcUxr+DqlDLNo= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= @@ -1720,6 +1717,7 @@ golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= @@ -1768,6 +1766,7 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201113234701-d7a72108b828/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= @@ -1778,6 +1777,8 @@ golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= diff --git a/plugins/goframe/net/ghttp/intercepter_test.go b/plugins/goframe/net/ghttp/intercepter_test.go new file mode 100644 index 00000000..7dbfa554 --- /dev/null +++ b/plugins/goframe/net/ghttp/intercepter_test.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 ghttp + +import ( + "bufio" + "net" + "net/http" + "testing" + "time" + + "github.com/apache/skywalking-go/plugins/core" + "github.com/apache/skywalking-go/plugins/core/operator" + + "github.com/stretchr/testify/assert" +) + +func TestGoFrameServerInterceptorInvoke(t *testing.T) { + defer core.ResetTracingContext() + interceptor := &GoFrameServerInterceptor{} + request, err := http.NewRequest("GET", "http://localhost/", http.NoBody) + assert.Nil(t, err, "new request error should be nil") + responseWriter := &testResponseWriter{} + invocation := operator.NewInvocation(nil, responseWriter, request) + err = interceptor.BeforeInvoke(invocation) + assert.Nil(t, err, "before invoke error should be nil") + assert.NotNil(t, invocation.GetContext(), "context should not be nil") + + time.Sleep(100 * time.Millisecond) + + err = interceptor.AfterInvoke(invocation) + assert.Nil(t, err, "after invoke error should be nil") + + time.Sleep(100 * time.Millisecond) + spans := core.GetReportedSpans() + assert.NotNil(t, spans, "spans should not be nil") + assert.Equal(t, 1, len(spans), "spans length should be 1") + assert.Equal(t, "GET:/", spans[0].OperationName(), "operation name should be GET:/") + assert.Nil(t, spans[0].Refs(), "refs should be nil") + assert.Greater(t, spans[0].EndTime(), spans[0].StartTime(), "end time should be greater than start time") +} + +type testResponseWriter struct { + http.ResponseWriter +} + +func (t *testResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { + listen, err := net.Listen("tcp", ":0") + if err != nil { + return nil, nil, err + } + defer listen.Close() + dial, err := net.Dial(listen.Addr().Network(), listen.Addr().String()) + if err != nil { + return nil, nil, err + } + return dial, nil, nil +} diff --git a/test/plugins/scenarios/goframe/bin/startup.sh b/test/plugins/scenarios/goframe/bin/startup.sh new file mode 100755 index 00000000..deb9c51e --- /dev/null +++ b/test/plugins/scenarios/goframe/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 http + +./goframe \ No newline at end of file diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml new file mode 100644 index 00000000..9e3897bc --- /dev/null +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -0,0 +1,68 @@ +# 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: http + segmentSize: ge 3 + segments: + - segmentId: not null + spans: + - operationName: GET:/provider + 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: 'localhost:8080/provider'} + - {key: http.params, value: 'test=1'} + - {key: status_code, value: '200'} + - segmentId: not null + spans: + - operationName: GET:/provider + 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'} + - {key: status_code, value: '200'} + - operationName: GET:/consumer + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: gt 0 + endTime: gt 0 + componentId: 5004 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false +meterItems: [] +logItems: [] \ No newline at end of file diff --git a/test/plugins/scenarios/goframe/go.mod b/test/plugins/scenarios/goframe/go.mod new file mode 100644 index 00000000..c6e853ae --- /dev/null +++ b/test/plugins/scenarios/goframe/go.mod @@ -0,0 +1,40 @@ +module test/plugins/scenarios/goframe + +go 1.19 + +require ( + github.com/apache/skywalking-go v0.5.0 + github.com/gogf/gf/v2 v2.7.3 +) + +require ( + github.com/BurntSushi/toml v1.3.2 // indirect + github.com/clbanning/mxj/v2 v2.7.0 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // 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/gorilla/websocket v1.5.1 // indirect + github.com/grokify/html-strip-tags-go v0.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/pkg/errors v0.9.1 // indirect + go.opentelemetry.io/otel v1.14.0 // indirect + go.opentelemetry.io/otel/sdk v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/text v0.14.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 + gopkg.in/yaml.v3 v3.0.1 // indirect + skywalking.apache.org/repo/goapi v0.0.0-20230314034821-0c5a44bb767a // indirect +) diff --git a/test/plugins/scenarios/goframe/go.sum b/test/plugins/scenarios/goframe/go.sum new file mode 100644 index 00000000..191c118b --- /dev/null +++ b/test/plugins/scenarios/goframe/go.sum @@ -0,0 +1,219 @@ +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/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +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.5.0 h1:wg77wdIC5EyffbTTprbTVRTi7hHiKB/Z8LWiyU3fZxI= +github.com/apache/skywalking-go v0.5.0/go.mod h1:vrfjgJ+a1R4N8v3s/1w7IuZrQoXsREnuZUQef+bzJ9c= +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/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= +github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= +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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +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/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/gogf/gf/v2 v2.7.3 h1:0RTqeDYJOrD/FpiSsEopTs5SvYg+u6WPtS0TaXJcGoQ= +github.com/gogf/gf/v2 v2.7.3/go.mod h1:EBXneAg/wes86rfeh68XC0a2JBNQylmT7Sp6/8Axk88= +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/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= +github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +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/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/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +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/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= +go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= +go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= +go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +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.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +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.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +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 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +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= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +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/goframe/main.go b/test/plugins/scenarios/goframe/main.go new file mode 100644 index 00000000..c95c4c3a --- /dev/null +++ b/test/plugins/scenarios/goframe/main.go @@ -0,0 +1,51 @@ +// 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 + +//go:nolint +import ( + "context" + _ "github.com/apache/skywalking-go" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gcmd" + "github.com/gogf/gf/v2/os/gctx" + "net/http" +) + +func main() { + command := gcmd.Command{ + Name: "goframe", + Usage: "goframe", + Brief: "start http server", + Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { + s := g.Server() + s.SetPort(8080) + s.BindHandler("/provider", func(r *ghttp.Request) { + r.Response.Write("success") + }) + s.BindHandler("/health", func(r *ghttp.Request) { + r.Response.WriteHeader(http.StatusOK) + r.Response.Write("success") + }) + s.Run() + return nil + }, + } + command.Run(gctx.New()) +} diff --git a/test/plugins/scenarios/goframe/plugin.yml b/test/plugins/scenarios/goframe/plugin.yml new file mode 100644 index 00000000..9e007eca --- /dev/null +++ b/test/plugins/scenarios/goframe/plugin.yml @@ -0,0 +1,28 @@ +# 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}/provider +health-checker: http://${HTTP_HOST}:${HTTP_PORT}/health +start-script: ./bin/startup.sh +framework: github.com/gogf/gf +export-port: 8080 +support-version: + - go: 1.18 + - go: 1.19 + - go: 1.20 + - go: 1.21 + - go: 1.22 + - go: 1.23 From 1f4a08bdbb480125c422b97aa168da93fc512bd9 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Wed, 18 Sep 2024 19:07:39 +0800 Subject: [PATCH 06/20] feat:add scenarios Plugin test --- test/plugins/scenarios/goframe/go.mod | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/plugins/scenarios/goframe/go.mod b/test/plugins/scenarios/goframe/go.mod index c6e853ae..fb1d1479 100644 --- a/test/plugins/scenarios/goframe/go.mod +++ b/test/plugins/scenarios/goframe/go.mod @@ -2,10 +2,7 @@ module test/plugins/scenarios/goframe go 1.19 -require ( - github.com/apache/skywalking-go v0.5.0 - github.com/gogf/gf/v2 v2.7.3 -) +require github.com/gogf/gf/v2 v2.7.3 require ( github.com/BurntSushi/toml v1.3.2 // indirect From 1fa351054991685fa3c9870ab531f1ee565af392 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Thu, 19 Sep 2024 11:20:12 +0800 Subject: [PATCH 07/20] fix:Complete relevant test cases, configure CI, and update CHANGES.md support-plugins.md --- .github/workflows/plugin-tests.yaml | 1 + CHANGES.md | 1 - docs/en/agent/support-plugins.md | 2 ++ go.work | 2 +- go.work.sum | 4 +++ plugins/goframe/net/ghttp/intercepter.go | 2 +- .../scenarios/goframe/config/excepted.yml | 11 +++++++- test/plugins/scenarios/goframe/main.go | 15 ++++++++++- test/plugins/scenarios/goframe/plugin.yml | 26 +++++++++++++++---- 9 files changed, 54 insertions(+), 10 deletions(-) diff --git a/.github/workflows/plugin-tests.yaml b/.github/workflows/plugin-tests.yaml index 73293829..503a965f 100644 --- a/.github/workflows/plugin-tests.yaml +++ b/.github/workflows/plugin-tests.yaml @@ -102,6 +102,7 @@ jobs: - pulsar - segmentio-kafka - go-elasticsearchv8 + - goframe steps: - uses: actions/checkout@v2 with: diff --git a/CHANGES.md b/CHANGES.md index e0fbfc33..c84e0d37 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,7 +8,6 @@ Release Notes. * support attaching events to span in the toolkit. * support record log in the toolkit. -* support goframev2 #### Plugins * Support [goframev2](https://github.com/gogf/gf) goframev2. diff --git a/docs/en/agent/support-plugins.md b/docs/en/agent/support-plugins.md index a59e4815..e0aa429c 100644 --- a/docs/en/agent/support-plugins.md +++ b/docs/en/agent/support-plugins.md @@ -11,9 +11,11 @@ metrics based on the tracing data. * `fasthttp`: [FastHttp](https://github.com/valyala/fasthttp) tested v1.10.0 to v1.50.0. * `fiber`: [Fiber](https://github.com/gofiber/fiber) tested v2.49.0 to v2.50.0. * `echov4`: [Echov4](https://github.com/labstack/echo) tested v4.0.0 to v4.11.4 + * `goframe`: [GoFrame](https://github.com/gogf/gf/) tested v2.6.0 to v2.7.3 * HTTP Client * `http`: [Native HTTP](https://pkg.go.dev/net/http) tested go v1.19 to go v1.23. * `fasthttp`: [FastHttp](https://github.com/valyala/fasthttp) tested v1.10.0 to v1.50.0. + * `goframe`: [GoFrame](https://github.com/gogf/gf/) tested v2.6.0 to v2.7.3 * RPC Frameworks * `dubbo`: [Dubbo](https://github.com/apache/dubbo-go) tested v3.0.1 to v3.0.5. * `kratosv2`: [Kratos](https://github.com/go-kratos/kratos) tested v2.3.1 to v2.6.2. diff --git a/go.work b/go.work index a3835edf..05a3142f 100644 --- a/go.work +++ b/go.work @@ -65,9 +65,9 @@ use ( ./test/plugins/scenarios/segmentio-kafka ./test/plugins/scenarios/go-elasticsearchv8 ./test/plugins/scenarios/logging-activation + ./test/plugins/scenarios/goframe ./tools/go-agent ./toolkit - test/plugins/scenarios/goframe ) diff --git a/go.work.sum b/go.work.sum index 6451f8e1..8955c42b 100644 --- a/go.work.sum +++ b/go.work.sum @@ -904,6 +904,8 @@ github.com/go-kratos/swagger-api v1.0.0 h1:R1JcAqLSvfDzqHoDnpK3Jt1MEJAXGNifV7AnB github.com/go-ldap/ldap v3.0.2+incompatible h1:kD5HQcAzlQ7yrhfn+h+MSABeAy/jAJhvIJ/QDllP44g= github.com/go-ldap/ldap/v3 v3.1.10 h1:7WsKqasmPThNvdl0Q5GPpbTDD/ZD98CfuawrMIuh7qQ= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-micro/plugins/v4/auth/jwt v1.2.0 h1:+dJHFnobRhX3QvTlHKCj5Sn2eeFsfNFzmFCc4HX5ULQ= github.com/go-micro/plugins/v4/auth/jwt v1.2.0/go.mod h1:6tHH9WrpbEwmNQKJj8DutZtZdvY9gl0XBRJPnzEwl6Q= github.com/go-micro/plugins/v4/broker/nats v1.1.0 h1:JCo2JksH0M6HC8q8L+x9QCqGRr5M0BADQw2Q50TWCas= @@ -1221,6 +1223,7 @@ github.com/lyft/protoc-gen-validate v0.0.13 h1:KNt/RhmQTOLr7Aj8PsJ7mTronaFyx80mR github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/marstr/guid v1.1.0 h1:/M4H/1G4avsieL6BbUwCOBzulmoeKVP5ux/3mQNnbyI= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= @@ -1352,6 +1355,7 @@ github.com/oklog/oklog v0.3.2 h1:wVfs8F+in6nTBMkA7CbRw+zZMIB7nNM825cM1wuzoTk= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5 h1:58+kh9C6jJVXYjt8IE48G2eWl6BjwU5Gj0gqY84fy78= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 h1:Yl0tPBa8QPjGmesFh1D0rDy+q1Twx6FyU7VWHi8wZbI= github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/plugins/goframe/net/ghttp/intercepter.go b/plugins/goframe/net/ghttp/intercepter.go index e8dfe596..72861e8e 100644 --- a/plugins/goframe/net/ghttp/intercepter.go +++ b/plugins/goframe/net/ghttp/intercepter.go @@ -36,7 +36,7 @@ func (h *GoFrameServerInterceptor) BeforeInvoke(invocation operator.Invocation) }, tracing.WithLayer(tracing.SpanLayerHTTP), tracing.WithTag(tracing.TagHTTPMethod, request.Method), tracing.WithTag(tracing.TagURL, request.Host+request.URL.Path), - tracing.WithComponent(5004)) + tracing.WithComponent(5022)) if err != nil { return err } diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml index 9e3897bc..b0124dd1 100644 --- a/test/plugins/scenarios/goframe/config/excepted.yml +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -26,7 +26,7 @@ segmentItems: spanLayer: Http startTime: nq 0 endTime: nq 0 - componentId: 5004 + componentId: 5022 isError: false spanType: Entry peer: '' @@ -36,6 +36,10 @@ segmentItems: - {key: url, value: 'localhost:8080/provider'} - {key: http.params, value: 'test=1'} - {key: status_code, value: '200'} + refs: + - {parentEndpoint: 'GET:/consumer', networkAddress: 'localhost:8080', refType: CrossProcess, + parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, + parentService: http, traceId: not null} - segmentId: not null spans: - operationName: GET:/provider @@ -64,5 +68,10 @@ segmentItems: spanType: Entry peer: '' skipAnalysis: false + tags: + - {key: http.method, value: GET} + - {key: url, value: 'service:8080/consumer'} + - {key: http.params, value: ''} + - {key: status_code, value: '200'} meterItems: [] logItems: [] \ No newline at end of file diff --git a/test/plugins/scenarios/goframe/main.go b/test/plugins/scenarios/goframe/main.go index c95c4c3a..b610058f 100644 --- a/test/plugins/scenarios/goframe/main.go +++ b/test/plugins/scenarios/goframe/main.go @@ -20,14 +20,16 @@ package main //go:nolint import ( "context" - _ "github.com/apache/skywalking-go" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/gctx" "net/http" + + _ "github.com/apache/skywalking-go" ) +//go:nolint func main() { command := gcmd.Command{ Name: "goframe", @@ -39,6 +41,16 @@ func main() { s.BindHandler("/provider", func(r *ghttp.Request) { r.Response.Write("success") }) + s.BindHandler("/consumer", func(r *ghttp.Request) { + var resp, err = g.Client().Get(gctx.GetInitCtx(), "http://localhost:8080/provider?test=1") + if err != nil { + r.Response.Write(err.Error()) + return + } + defer resp.Close() + var str = resp.ReadAllString() + r.Response.Write(str) + }) s.BindHandler("/health", func(r *ghttp.Request) { r.Response.WriteHeader(http.StatusOK) r.Response.Write("success") @@ -48,4 +60,5 @@ func main() { }, } command.Run(gctx.New()) + } diff --git a/test/plugins/scenarios/goframe/plugin.yml b/test/plugins/scenarios/goframe/plugin.yml index 9e007eca..3d07b78a 100644 --- a/test/plugins/scenarios/goframe/plugin.yml +++ b/test/plugins/scenarios/goframe/plugin.yml @@ -14,15 +14,31 @@ # See the License for the specific language governing permissions and # limitations under the License. -entry-service: http://${HTTP_HOST}:${HTTP_PORT}/provider +entry-service: http://${HTTP_HOST}:${HTTP_PORT}/consumer health-checker: http://${HTTP_HOST}:${HTTP_PORT}/health start-script: ./bin/startup.sh framework: github.com/gogf/gf export-port: 8080 support-version: - go: 1.18 - - go: 1.19 - - go: 1.20 - - go: 1.21 - - go: 1.22 + framework: + - v2.7.3 + - v2.7.2 + - v2.7.1 + - v2.7.0 + - v2.6.4 + - v2.6.3 + - v2.6.2 + - v2.6.1 + - v2.6.0 - go: 1.23 + framework: + - v2.7.3 + - v2.7.2 + - v2.7.1 + - v2.7.0 + - v2.6.4 + - v2.6.3 + - v2.6.2 + - v2.6.1 + - v2.6.0 From ca7937aaa07391ffacc144680c2d4010c6c95515 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Thu, 19 Sep 2024 11:47:54 +0800 Subject: [PATCH 08/20] fix:register.go lint --- tools/go-agent/instrument/plugins/register.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/go-agent/instrument/plugins/register.go b/tools/go-agent/instrument/plugins/register.go index dd17021a..27e15a99 100644 --- a/tools/go-agent/instrument/plugins/register.go +++ b/tools/go-agent/instrument/plugins/register.go @@ -87,7 +87,7 @@ func init() { // echov4 related instruments registerFramework(echov4.NewInstrument()) - //goframe + // goframe registerFramework(goframe.NewInstrument()) } From ca49039df80766607bf2c5a44ad55047f55990bd Mon Sep 17 00:00:00 2001 From: lidiwei Date: Thu, 19 Sep 2024 12:31:00 +0800 Subject: [PATCH 09/20] update: support-plugins.md --- docs/en/agent/support-plugins.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/en/agent/support-plugins.md b/docs/en/agent/support-plugins.md index e0aa429c..f7613834 100644 --- a/docs/en/agent/support-plugins.md +++ b/docs/en/agent/support-plugins.md @@ -15,7 +15,6 @@ metrics based on the tracing data. * HTTP Client * `http`: [Native HTTP](https://pkg.go.dev/net/http) tested go v1.19 to go v1.23. * `fasthttp`: [FastHttp](https://github.com/valyala/fasthttp) tested v1.10.0 to v1.50.0. - * `goframe`: [GoFrame](https://github.com/gogf/gf/) tested v2.6.0 to v2.7.3 * RPC Frameworks * `dubbo`: [Dubbo](https://github.com/apache/dubbo-go) tested v3.0.1 to v3.0.5. * `kratosv2`: [Kratos](https://github.com/go-kratos/kratos) tested v2.3.1 to v2.6.2. From ef4cc3e4935dd12da706034ee26df299c11050b0 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Thu, 19 Sep 2024 16:52:33 +0800 Subject: [PATCH 10/20] fix:lint --- plugins/goframe/net/ghttp/intercepter.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/goframe/net/ghttp/intercepter.go b/plugins/goframe/net/ghttp/intercepter.go index 72861e8e..ceda0f86 100644 --- a/plugins/goframe/net/ghttp/intercepter.go +++ b/plugins/goframe/net/ghttp/intercepter.go @@ -17,12 +17,13 @@ package ghttp -//go:nolint +// nolint import ( "fmt" + "net/http" + "github.com/apache/skywalking-go/plugins/core/operator" "github.com/apache/skywalking-go/plugins/core/tracing" - "net/http" ) // GoFrameServerInterceptor is used to intercept and trace HTTP requests. From 06dd7fb50e1191feec9ef966a4ebb2fe8b038073 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Thu, 19 Sep 2024 17:06:19 +0800 Subject: [PATCH 11/20] fix:lint import --- plugins/goframe/instrument.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/goframe/instrument.go b/plugins/goframe/instrument.go index eab2e7c8..b1c37b9c 100644 --- a/plugins/goframe/instrument.go +++ b/plugins/goframe/instrument.go @@ -20,8 +20,9 @@ package goframe //go:nolint import ( "embed" - "github.com/apache/skywalking-go/plugins/core/instrument" "strings" + + "github.com/apache/skywalking-go/plugins/core/instrument" ) //go:embed * From 26155491d043a40b6248564f65b7ec436b297afd Mon Sep 17 00:00:00 2001 From: lidiwei Date: Thu, 19 Sep 2024 17:29:15 +0800 Subject: [PATCH 12/20] fix:lint import complement --- test/plugins/scenarios/goframe/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/plugins/scenarios/goframe/main.go b/test/plugins/scenarios/goframe/main.go index b610058f..78237cb9 100644 --- a/test/plugins/scenarios/goframe/main.go +++ b/test/plugins/scenarios/goframe/main.go @@ -20,11 +20,12 @@ package main //go:nolint import ( "context" + "net/http" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/gctx" - "net/http" _ "github.com/apache/skywalking-go" ) From 6bfe76c3a48303849b0c950dd2a83b228a87a0d4 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 09:08:08 +0800 Subject: [PATCH 13/20] fix:excepted.yml serviceName --- test/plugins/scenarios/goframe/config/excepted.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml index b0124dd1..bed5a63b 100644 --- a/test/plugins/scenarios/goframe/config/excepted.yml +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -15,7 +15,7 @@ # limitations under the License. segmentItems: - - serviceName: http + - serviceName: goframe segmentSize: ge 3 segments: - segmentId: not null @@ -39,7 +39,7 @@ segmentItems: refs: - {parentEndpoint: 'GET:/consumer', networkAddress: 'localhost:8080', refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not null, - parentService: http, traceId: not null} + parentService: goframe, traceId: not null} - segmentId: not null spans: - operationName: GET:/provider From f88c36bbb727e54b7eb97af330bf7fa3cd092394 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 09:29:24 +0800 Subject: [PATCH 14/20] fix:excepted.yml serviceName 2 --- test/plugins/scenarios/goframe/bin/startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugins/scenarios/goframe/bin/startup.sh b/test/plugins/scenarios/goframe/bin/startup.sh index deb9c51e..b00cdfc7 100755 --- a/test/plugins/scenarios/goframe/bin/startup.sh +++ b/test/plugins/scenarios/goframe/bin/startup.sh @@ -17,6 +17,6 @@ # limitations under the License. home="$(cd "$(dirname $0)"; pwd)" -go build ${GO_BUILD_OPTS} -o http +go build ${GO_BUILD_OPTS} -o goframe ./goframe \ No newline at end of file From b538914a732017465a8c1d603c280e48e40b5204 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 10:07:53 +0800 Subject: [PATCH 15/20] fix:excepted.yml componentId 5022 --- test/plugins/scenarios/goframe/config/excepted.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml index bed5a63b..a0711aa0 100644 --- a/test/plugins/scenarios/goframe/config/excepted.yml +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -63,7 +63,7 @@ segmentItems: spanLayer: Http startTime: gt 0 endTime: gt 0 - componentId: 5004 + componentId: 5022 isError: false spanType: Entry peer: '' From b2723e913ba1d20a9a82a17927ba705e08ed7464 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 14:31:05 +0800 Subject: [PATCH 16/20] feat:add goframe plugins config --- docs/en/agent/plugin-configurations.md | 21 +++++++------ plugins/goframe/net/ghttp/config.go | 25 ++++++++++++++++ plugins/goframe/net/ghttp/intercepter.go | 30 ++++++++++++++++++- test/plugins/scenarios/goframe/bin/startup.sh | 4 +++ test/plugins/scenarios/goframe/main.go | 5 +++- tools/go-agent/config/agent.default.yaml | 11 ++++++- 6 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 plugins/goframe/net/ghttp/config.go diff --git a/docs/en/agent/plugin-configurations.md b/docs/en/agent/plugin-configurations.md index b4c73183..2024c0bc 100644 --- a/docs/en/agent/plugin-configurations.md +++ b/docs/en/agent/plugin-configurations.md @@ -1,11 +1,14 @@ # Plugin Configurations -| key | environment key | default value | description | -|--------------------------------|-------------------------------------------------------|---------------|----------------------------------------------------------------| -| http.server_collect_parameters | SW_AGENT_PLUGIN_CONFIG_HTTP_SERVER_COLLECT_PARAMETERS | false | Collect the parameters of the HTTP request on the server side. | -| mongo.collect_statement | SW_AGENT_PLUGIN_CONFIG_MONGO_COLLECT_STATEMENT | false | Collect the statement of the MongoDB request. | -| sql.collect_parameter | SW_AGENT_PLUGIN_CONFIG_SQL_COLLECT_PARAMETER | false | Collect the parameter of the SQL request. | -| redis.max_args_bytes | SW_AGENT_PLUGIN_CONFIG_REDIS_MAX_ARGS_BYTES | 1024 | Limit the bytes size of redis args request. | -| reporter.discard | SW_AGENT_REPORTER_DISCARD | false | Discard the reporter. | -| gin.collect_request_headers | SW_AGENT_PLUGIN_CONFIG_GIN_COLLECT_REQUEST_HEADERS | | Collect the http header of gin request. | -| gin.header_length_threshold | SW_AGENT_PLUGIN_CONFIG_GIN_HEADER_LENGTH_THRESHOLD | 2048 | Controlling the length limitation of all header values. | \ No newline at end of file +| key | environment key | default value | description | +|------------------------------------|-----------------------------------------------------------|---------------|----------------------------------------------------------------| +| http.server_collect_parameters | SW_AGENT_PLUGIN_CONFIG_HTTP_SERVER_COLLECT_PARAMETERS | false | Collect the parameters of the HTTP request on the server side. | +| mongo.collect_statement | SW_AGENT_PLUGIN_CONFIG_MONGO_COLLECT_STATEMENT | false | Collect the statement of the MongoDB request. | +| sql.collect_parameter | SW_AGENT_PLUGIN_CONFIG_SQL_COLLECT_PARAMETER | false | Collect the parameter of the SQL request. | +| redis.max_args_bytes | SW_AGENT_PLUGIN_CONFIG_REDIS_MAX_ARGS_BYTES | 1024 | Limit the bytes size of redis args request. | +| reporter.discard | SW_AGENT_REPORTER_DISCARD | false | Discard the reporter. | +| gin.collect_request_headers | SW_AGENT_PLUGIN_CONFIG_GIN_COLLECT_REQUEST_HEADERS | | Collect the http header of gin request. | +| gin.header_length_threshold | SW_AGENT_PLUGIN_CONFIG_GIN_HEADER_LENGTH_THRESHOLD | 2048 | Controlling the length limitation of all header values. | +| goframe.collect_request_parameters | SW_AGENT_PLUGIN_CONFIG_GOFRAME_COLLECT_REQUEST_PARAMETERS | false | Collect the parameters of the HTTP request on the server side. | +| goframe.collect_request_headers | SW_AGENT_PLUGIN_CONFIG_GOFRAME_COLLECT_REQUEST_HEADERS | | Collect the http header of goframe request. | +| goframe.header_length_threshold | SW_AGENT_PLUGIN_CONFIG_GOFRAME_HEADER_LENGTH_THRESHOLD | 2048 | Controlling the length limitation of all header values. | \ No newline at end of file diff --git a/plugins/goframe/net/ghttp/config.go b/plugins/goframe/net/ghttp/config.go new file mode 100644 index 00000000..bacb2733 --- /dev/null +++ b/plugins/goframe/net/ghttp/config.go @@ -0,0 +1,25 @@ +// 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 ghttp + +//skywalking:config goframe +var config struct { + CollectRequestParameters bool `config:"collect_request_parameters"` + CollectRequestHeaders []string `config:"collect_request_headers"` + HeaderLengthThreshold int `config:"header_length_threshold"` +} diff --git a/plugins/goframe/net/ghttp/intercepter.go b/plugins/goframe/net/ghttp/intercepter.go index ceda0f86..96eda925 100644 --- a/plugins/goframe/net/ghttp/intercepter.go +++ b/plugins/goframe/net/ghttp/intercepter.go @@ -21,6 +21,7 @@ package ghttp import ( "fmt" "net/http" + "strings" "github.com/apache/skywalking-go/plugins/core/operator" "github.com/apache/skywalking-go/plugins/core/tracing" @@ -42,7 +43,12 @@ func (h *GoFrameServerInterceptor) BeforeInvoke(invocation operator.Invocation) return err } - s.Tag(tracing.TagHTTPParams, request.URL.RawQuery) + if config.CollectRequestParameters && request.URL != nil { + s.Tag(tracing.TagHTTPParams, request.URL.RawQuery) + } + if len(config.CollectRequestHeaders) > 0 { + collectRequestHeaders(s, request.Header) + } writer := invocation.Args()[0].(http.ResponseWriter) invocation.ChangeArg(0, &writerWrapper{ResponseWriter: writer, statusCode: http.StatusOK}) @@ -67,3 +73,25 @@ type writerWrapper struct { http.ResponseWriter statusCode int } + +func collectRequestHeaders(span tracing.Span, requestHeaders http.Header) { + var headerTagValues []string + for _, header := range config.CollectRequestHeaders { + var headerValue = requestHeaders.Get(header) + if headerValue != "" { + headerTagValues = append(headerTagValues, header+"="+headerValue) + } + } + + if len(headerTagValues) == 0 { + return + } + + tagValue := strings.Join(headerTagValues, "\n") + if len(tagValue) > config.HeaderLengthThreshold { + maxLen := config.HeaderLengthThreshold + tagValue = tagValue[:maxLen] + } + + span.Tag(tracing.TagHTTPHeaders, tagValue) +} diff --git a/test/plugins/scenarios/goframe/bin/startup.sh b/test/plugins/scenarios/goframe/bin/startup.sh index b00cdfc7..7d283705 100755 --- a/test/plugins/scenarios/goframe/bin/startup.sh +++ b/test/plugins/scenarios/goframe/bin/startup.sh @@ -19,4 +19,8 @@ home="$(cd "$(dirname $0)"; pwd)" go build ${GO_BUILD_OPTS} -o goframe +export SW_AGENT_PLUGIN_CONFIG_GOFRAME_COLLECT_REQUEST_PARAMETERS=true +export SW_AGENT_PLUGIN_CONFIG_GOFRAME_COLLECT_REQUEST_HEADERS=h1,h2 +export SW_AGENT_PLUGIN_CONFIG_GOFRAME_HEADER_LENGTH_THRESHOLD=17 + ./goframe \ No newline at end of file diff --git a/test/plugins/scenarios/goframe/main.go b/test/plugins/scenarios/goframe/main.go index 78237cb9..9cdb9680 100644 --- a/test/plugins/scenarios/goframe/main.go +++ b/test/plugins/scenarios/goframe/main.go @@ -43,7 +43,10 @@ func main() { r.Response.Write("success") }) s.BindHandler("/consumer", func(r *ghttp.Request) { - var resp, err = g.Client().Get(gctx.GetInitCtx(), "http://localhost:8080/provider?test=1") + client := g.Client() + client.SetHeader("h1", "h1") + client.SetHeader("h2", "h2") + var resp, err = client.Get(gctx.GetInitCtx(), "http://localhost:8080/provider?test=1") if err != nil { r.Response.Write(err.Error()) return diff --git a/tools/go-agent/config/agent.default.yaml b/tools/go-agent/config/agent.default.yaml index c7e3f81e..8e14390d 100644 --- a/tools/go-agent/config/agent.default.yaml +++ b/tools/go-agent/config/agent.default.yaml @@ -110,4 +110,13 @@ plugin: # Collect the http header of gin request collect_request_headers: ${SW_AGENT_PLUGIN_CONFIG_GIN_COLLECT_REQUEST_HEADERS:} # Controlling the length limitation of all header values - header_length_threshold: ${SW_AGENT_PLUGIN_CONFIG_GIN_HEADER_LENGTH_THRESHOLD:2048} \ No newline at end of file + header_length_threshold: ${SW_AGENT_PLUGIN_CONFIG_GIN_HEADER_LENGTH_THRESHOLD:2048} + goframe: + # Collect the parameters of the HTTP request on the server side + collect_request_parameters: ${SW_AGENT_PLUGIN_CONFIG_GOFRAME_COLLECT_REQUEST_PARAMETERS:false} + # Collect the http header of goframe request + collect_request_headers: ${SW_AGENT_PLUGIN_CONFIG_GOFRAME_COLLECT_REQUEST_HEADERS:} + # Controlling the length limitation of all header values + header_length_threshold: ${SW_AGENT_PLUGIN_CONFIG_GOFRAME_HEADER_LENGTH_THRESHOLD:2048} + + From 9af805688ae176aece5b9b20d4ddb443001fe178 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 14:59:51 +0800 Subject: [PATCH 17/20] fix:ci goframe plugins config tags check --- test/plugins/scenarios/goframe/config/excepted.yml | 3 ++- test/plugins/scenarios/goframe/main.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml index a0711aa0..10c780e1 100644 --- a/test/plugins/scenarios/goframe/config/excepted.yml +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -56,6 +56,8 @@ segmentItems: tags: - {key: http.method, value: GET} - {key: url, value: 'localhost:8080/provider'} + - {key: http.headers, value: "h1=h1-value\nh2=h2"} + - {key: http.params, value: 'test=1'} - {key: status_code, value: '200'} - operationName: GET:/consumer parentSpanId: -1 @@ -71,7 +73,6 @@ segmentItems: tags: - {key: http.method, value: GET} - {key: url, value: 'service:8080/consumer'} - - {key: http.params, value: ''} - {key: status_code, value: '200'} meterItems: [] logItems: [] \ No newline at end of file diff --git a/test/plugins/scenarios/goframe/main.go b/test/plugins/scenarios/goframe/main.go index 9cdb9680..29635c64 100644 --- a/test/plugins/scenarios/goframe/main.go +++ b/test/plugins/scenarios/goframe/main.go @@ -44,8 +44,8 @@ func main() { }) s.BindHandler("/consumer", func(r *ghttp.Request) { client := g.Client() - client.SetHeader("h1", "h1") - client.SetHeader("h2", "h2") + client.SetHeader("h1", "h1-value") + client.SetHeader("h2", "h2-value") var resp, err = client.Get(gctx.GetInitCtx(), "http://localhost:8080/provider?test=1") if err != nil { r.Response.Write(err.Error()) From 749588a3ac319a6618eee0d66110d193d4aa1723 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 15:08:58 +0800 Subject: [PATCH 18/20] fix:ci goframe plugins config tags check 2 --- test/plugins/scenarios/goframe/config/excepted.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml index 10c780e1..c4faa340 100644 --- a/test/plugins/scenarios/goframe/config/excepted.yml +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -34,6 +34,7 @@ segmentItems: tags: - {key: http.method, value: GET} - {key: url, value: 'localhost:8080/provider'} + - {key: http.headers, value: "h1=h1-value\nh2=h2"} - {key: http.params, value: 'test=1'} - {key: status_code, value: '200'} refs: From 87867f71a12d54bbfd8b541ee29cfeeb428208cf Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 15:50:51 +0800 Subject: [PATCH 19/20] fix:ci goframe plugins config tags check order --- test/plugins/scenarios/goframe/config/excepted.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml index c4faa340..bcfe4fc6 100644 --- a/test/plugins/scenarios/goframe/config/excepted.yml +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -34,8 +34,8 @@ segmentItems: tags: - {key: http.method, value: GET} - {key: url, value: 'localhost:8080/provider'} - - {key: http.headers, value: "h1=h1-value\nh2=h2"} - {key: http.params, value: 'test=1'} + - {key: http.headers, value: "h1=h1-value\nh2=h2"} - {key: status_code, value: '200'} refs: - {parentEndpoint: 'GET:/consumer', networkAddress: 'localhost:8080', refType: CrossProcess, @@ -57,8 +57,8 @@ segmentItems: tags: - {key: http.method, value: GET} - {key: url, value: 'localhost:8080/provider'} - - {key: http.headers, value: "h1=h1-value\nh2=h2"} - {key: http.params, value: 'test=1'} + - {key: http.headers, value: "h1=h1-value\nh2=h2"} - {key: status_code, value: '200'} - operationName: GET:/consumer parentSpanId: -1 From 9b81b945407be4a26df9f07ec08ecee78e265313 Mon Sep 17 00:00:00 2001 From: lidiwei Date: Fri, 20 Sep 2024 16:21:10 +0800 Subject: [PATCH 20/20] fix:ci goframe plugins config tags check 3 --- test/plugins/scenarios/goframe/config/excepted.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/plugins/scenarios/goframe/config/excepted.yml b/test/plugins/scenarios/goframe/config/excepted.yml index bcfe4fc6..d0a9f381 100644 --- a/test/plugins/scenarios/goframe/config/excepted.yml +++ b/test/plugins/scenarios/goframe/config/excepted.yml @@ -57,8 +57,6 @@ segmentItems: tags: - {key: http.method, value: GET} - {key: url, value: 'localhost:8080/provider'} - - {key: http.params, value: 'test=1'} - - {key: http.headers, value: "h1=h1-value\nh2=h2"} - {key: status_code, value: '200'} - operationName: GET:/consumer parentSpanId: -1 @@ -74,6 +72,7 @@ segmentItems: tags: - {key: http.method, value: GET} - {key: url, value: 'service:8080/consumer'} + - {key: http.params, value: ''} - {key: status_code, value: '200'} meterItems: [] logItems: [] \ No newline at end of file