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