mrproliu commented on code in PR #209:
URL: https://github.com/apache/skywalking-go/pull/209#discussion_r1804300997
##########
tools/go-agent/config/agent.default.yaml:
##########
@@ -118,5 +118,9 @@ plugin:
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}
-
+ gozero:
+ # Collect the parameters of gozero request
+ collect_request_parameters:
${SW_AGENT_PLUGIN_CONFIG_GOZERO_COLLECT_REQUEST_PARAMETERS:true}
+ # Collect the parameters of the gozero logx
+ collect_logx: ${SW_AGENT_PLUGIN_CONFIG_GOZERO_COLLECT_LOGX:true}
Review Comment:
To reduce network traffic usage and storage usage, please default to turning
off parameters and logs.
##########
plugins/gozero/core/logx/logx_error_intercepter.go:
##########
@@ -0,0 +1,45 @@
+package logx
+
+import (
+ "fmt"
+ "github.com/apache/skywalking-go/plugins/core/operator"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+)
+
+type LoggerErrorInterceptor struct {
+}
+
+var createLogxSpan = func(invocation operator.Invocation, operation string)
(tracing.Span, error) {
+ argLen := len(invocation.Args())
+ if argLen == 0 {
+ return nil, nil
+ }
+ var logxData string
+ if argLen == 1 {
+ logxData = fmt.Sprint(invocation.Args()[0].([]any)...)
+ } else {
+ logxData = fmt.Sprintf(invocation.Args()[0].(string),
invocation.Args()[1].([]any)...)
+ }
+ return tracing.CreateLocalSpan(fmt.Sprintf("logx.%s", operation),
tracing.WithTag("content", logxData), tracing.WithComponent(5023))
Review Comment:
```suggestion
return tracing.CreateLocalSpan(fmt.Sprintf("logx/%s", operation),
tracing.WithTag("content", logxData), tracing.WithComponent(5023))
```
##########
test/plugins/scenarios/gozero/config/excepted.yml:
##########
@@ -0,0 +1,136 @@
+# 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: gozero
+ segmentSize: ge 1
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: GET:/user/info
+ parentSpanId: -1
+ spanId: 1
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 5023
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: http.method, value: GET}
+ - {key: url, value: 'localhost:8888/user/info'}
+ - {key: http.params, value: not null}
+ - {key: status_code, value: '200'}
+ refs:
+ - {parentEndpoint: 'GET:/user/info?id=1', networkAddress:
'localhost:8080', refType: CrossProcess,
+ parentSpanId: 1, parentTraceSegmentId: not null,
parentServiceInstance: not null,
+ parentService: gozero, traceId: not null}
+ - operationName: logx.info
+ parentSpanId: 1
+ spanId: 2
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 5023
+ isError: false
+ spanType: Local
+ tags:
+ - {key: content, value: 'user api find: &{Id:0 Uuid:}'}
+ - operationName: logx.error
+ parentSpanId: 1
+ spanId: 3
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 5023
+ isError: false
+ spanType: Local
+ tags:
+ - {key: content, value: 'test error log'}
+ - operationName: user.User.UserFind
+ parentSpanId: 1
+ spanId: 4
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 23
+ isError: false
+ spanType: Exit
+ tags:
+ - { key: url, value: not null }
+ - { key: rpc.type, value: Unary }
+ - operationName: user.User.UserFind/Client/Request/SendMsg
+ parentSpanId: 4
+ spanId: 5
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 23
+ isError: false
+ spanType: Local
+ tags:
+ - { key: url, value: not null }
+ - operationName: user.User.UserFind/Client/Response/RecvMsg
+ parentSpanId: 4
+ spanId: 6
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 23
+ isError: false
+ spanType: Local
+ tags:
+ - { key: url, value: not null }
+ - operationName: user.User.UserFind
+ parentSpanId: 4
+ spanId: 7
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 23
+ isError: false
+ spanType: Entry
+ tags:
+ - { key: url, value: not null }
+ - { key: rpc.type, value: Unary }
+ - operationName: /user.User/UserFind
Review Comment:
I think zrpc should be a framework similar to grpc, mainly used for
communication between multiple processes, right? Then why is the RPC-related
span still local? As I understand it, there should be entry and exit spans.
##########
test/plugins/scenarios/gozero/config/excepted.yml:
##########
@@ -0,0 +1,136 @@
+# 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: gozero
+ segmentSize: ge 1
+ segments:
+ - segmentId: not null
Review Comment:
Why is there just a single segment, if they are cross-process, it should
have two segments. Please correct me if I'm wrong.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]