You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "CodePrometheus (via GitHub)" <gi...@apache.org> on 2024/02/13 05:18:29 UTC
[PR] feature: add support for rocketMQ [skywalking-go]
CodePrometheus opened a new pull request, #169:
URL: https://github.com/apache/skywalking-go/pull/169
### summary
[RockeMQ](https://github.com/apache/rocketmq-client-go) is a native go client maintained by the apache rocketMQ team.
### test report
I intercepted the `SendSync`, `SendAsync`, and `SendOneWay` methods in the producer, as shown in the figure below.
<img width="400" alt="case1" src="https://github.com/apache/skywalking-go/assets/66550292/e0b3e185-7287-4aba-9589-95dea9597a06">
<img width="400" alt="case2" src="https://github.com/apache/skywalking-go/assets/66550292/eb2fe7f6-b6cc-4b1c-95be-c303aa13a328">
<img width="400" alt="case3" src="https://github.com/apache/skywalking-go/assets/66550292/28509622-b749-475a-b88f-05be8457d623">
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1490737970
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:
ok, I will use different operationName to identify async and its corresponding callback.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488851874
##########
test/plugins/scenarios/rocketmq/config/excepted.yml:
##########
@@ -0,0 +1,181 @@
+# 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: rocketmq
+ segmentSize: ge 9
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.topic, value: not null }
+ - { key: mq.status, value: not null }
+ - { key: mq.queue, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Consumer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 39
+ isError: false
+ spanType: Entry
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - { key: mq.topic, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.status, value: not null }
+ refs:
+ - { parentEndpoint: RocketMQ/sw-topic/Producer, networkAddress: 'http://mqnamesrv:9876',
+ refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: rocketmq,
+ traceId: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer/Callback
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
Review Comment:
Ok, then please update the excepted files by comment, to make its more clear.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488845188
##########
test/plugins/scenarios/rocketmq/config/excepted.yml:
##########
@@ -0,0 +1,181 @@
+# 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: rocketmq
+ segmentSize: ge 9
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.topic, value: not null }
+ - { key: mq.status, value: not null }
+ - { key: mq.queue, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Consumer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 39
+ isError: false
+ spanType: Entry
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - { key: mq.topic, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.status, value: not null }
+ refs:
+ - { parentEndpoint: RocketMQ/sw-topic/Producer, networkAddress: 'http://mqnamesrv:9876',
+ refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: rocketmq,
+ traceId: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer/Callback
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
Review Comment:
Could you help to do more explain the callback spans. When should be exit or local?
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1945657261
@mrproliu Any idea?
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488760989
##########
test/plugins/scenarios/rocketmq/config/excepted.yml:
##########
@@ -0,0 +1,181 @@
+# 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: rocketmq
+ segmentSize: ge 9
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.topic, value: not null }
+ - { key: mq.status, value: not null }
+ - { key: mq.queue, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Consumer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 39
+ isError: false
+ spanType: Entry
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - { key: mq.topic, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.status, value: not null }
+ refs:
+ - { parentEndpoint: RocketMQ/sw-topic/Producer, networkAddress: 'http://mqnamesrv:9876',
+ refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: rocketmq,
+ traceId: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer/Callback
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
Review Comment:
Following your code in the callback, I think it should be Local span?
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:
Please invoke this method in the execute handler, it more like the real scene.
##########
plugins/rocketmq/consumer/consumer.go:
##########
@@ -0,0 +1,92 @@
+// 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 consumer
+
+import (
+ "strings"
+
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+
+ "github.com/apache/skywalking-go/plugins/core/operator"
+)
+
+const (
+ rmqConsumerComponentID = 39
+ rmqConsumerPrefix = "RocketMQ/"
+ rmqConsumerSuffix = "/Consumer"
+ tagMQMsgID = "mq.msg.id"
+ tagMQOffsetMsgID = "mq.offset.msg.id"
+ semicolon = ";"
+)
+
+type SwConsumerInterceptor struct {
+}
+
+func (c *SwConsumerInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+ pushConsumer := invocation.CallerInstance().(*nativepushConsumer)
+ peer := strings.Join(pushConsumer.client.GetNameSrv().AddrList(), semicolon)
+ subMsgs := invocation.Args()[1].([]*primitive.MessageExt)
+ if len(subMsgs) == 0 {
+ return nil
+ }
+ topic, addr := subMsgs[0].Topic, subMsgs[0].StoreHost
+ operationName := rmqConsumerPrefix + topic + rmqConsumerSuffix
+
+ var (
+ span tracing.Span
+ err error
+ )
+ for _, msg := range subMsgs {
+ span, err = tracing.CreateEntrySpan(operationName, func(headerKey string) (string, error) {
+ return msg.GetProperty(headerKey), nil
+ },
+ tracing.WithLayer(tracing.SpanLayerMQ),
+ tracing.WithComponent(rmqConsumerComponentID),
+ tracing.WithTag(tagMQMsgID, msg.MsgId),
+ tracing.WithTag(tagMQOffsetMsgID, msg.OffsetMsgId),
+ )
+ if err != nil {
+ return err
+ }
+ }
+ span.Tag(tracing.TagMQTopic, topic)
Review Comment:
Could you change this into the CreateEntrySpan method?
##########
test/plugins/scenarios/rocketmq/config/excepted.yml:
##########
@@ -0,0 +1,181 @@
+# 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: rocketmq
+ segmentSize: ge 9
+ segments:
+ - segmentId: not null
Review Comment:
Why all segments only have single span? I think some span should belong to the same segment.
##########
plugins/rocketmq/producer/send_one_way.go:
##########
@@ -0,0 +1,42 @@
+// 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 producer
+
+import (
+ "github.com/apache/skywalking-go/plugins/core/operator"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+)
+
+type SendOneWayInterceptor struct {
+}
+
+func (s *SendOneWayInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+ return SimpleProducerInterceptor(invocation)
Review Comment:
This method name is confuse, please update this function name.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488846508
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:
I mean, you should adding send message(producer) to the http handler, the consumer should other thing. Because you have two entry span, so the span name been rewrited.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1490732951
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:

They have same span name, I think I could make user confuse, should we change names?
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1941014602
<img width="400" alt="image" src="https://github.com/apache/skywalking-go/assets/66550292/7cbb9043-5706-429f-8367-2122c2765046">
<img width="400" alt="image" src="https://github.com/apache/skywalking-go/assets/66550292/c83d26ec-d8fd-4314-a2c0-dd1f1777b7d1">
The further process driven by the message will be in the same context, the context can be propagated and intercepted as it is passed down the execution chain
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1940460141
I mean, the consumer codes, it would do business operations, such as accessing SQL database, cache, which are supported to be traced. Are they im the same trace?
The reason I am asking for is, message consuming sometimes has a kind of async mechanisms, which may change the tracing context incorrectly. It is better to recheck with demo codes.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1945722658
> Sorry for the recurring problem on `CI / Tests (pull_request) `. My `golangci-lint` attempt on the local mac seems to be inconsistent with that on github. Is there any additional configuration required besides `make lint`?
For now, you can delete the local lint command, then, it could be download the specific lint command by `make lint` automatically.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488807080
##########
plugins/rocketmq/producer/send_one_way.go:
##########
@@ -0,0 +1,42 @@
+// 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 producer
+
+import (
+ "github.com/apache/skywalking-go/plugins/core/operator"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+)
+
+type SendOneWayInterceptor struct {
+}
+
+func (s *SendOneWayInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+ return SimpleProducerInterceptor(invocation)
Review Comment:
What I want to express is that sendSync and SendOneWay share a BeforeInvoke, `GeneralProducerBeforeInvoke` What do you think
##########
test/plugins/scenarios/rocketmq/config/excepted.yml:
##########
@@ -0,0 +1,181 @@
+# 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: rocketmq
+ segmentSize: ge 9
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.topic, value: not null }
+ - { key: mq.status, value: not null }
+ - { key: mq.queue, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Consumer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 39
+ isError: false
+ spanType: Entry
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - { key: mq.topic, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.status, value: not null }
+ refs:
+ - { parentEndpoint: RocketMQ/sw-topic/Producer, networkAddress: 'http://mqnamesrv:9876',
+ refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: rocketmq,
+ traceId: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer/Callback
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
Review Comment:
There are two callback spans, the first is [exit](https://github.com/apache/skywalking-go/pull/169/files#diff-8f790a9cc27657931636c2242e8089661e539d72262132c1837cce958b2fd40fR75) and the second is [local](https://github.com/apache/skywalking-go/pull/169/files#diff-8f790a9cc27657931636c2242e8089661e539d72262132c1837cce958b2fd40fR90)
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488807930
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:
During development, I encountered the same problem as before https://github.com/apache/skywalking-go/pull/165#issuecomment-1935516907
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1491899179
##########
test/plugins/scenarios/rocketmq/config/excepted.yml:
##########
@@ -0,0 +1,181 @@
+# 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: rocketmq
+ segmentSize: ge 9
+ segments:
+ - segmentId: not null
Review Comment:
fixed
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1942733164
Good to me. Let's wait for @mrproliu review.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1940449147
Ref https://github.com/apache/skywalking/pull/11877
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1940456228
> Could you confirm, is the further process driven by the message going to be in the same context?
I think so, so I added headKey in properties, I'm not sure if I'm articulating the point you want to ask about
```
type Message struct {
properties map[string]string
}
```
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1947674473
> For now, you can delete the local lint command, then, it could be download the specific lint command by `make lint` automatically.
Thanks, it works, from yesterday's [test](https://github.com/apache/skywalking-go/actions/runs/7913023188/job/21600110686#step:5:1423), the order of consuming messages is not in the order of message sending, this will affect the stability of plugins test, this time I adjusted the relevant files again
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1940657375
I double checked, they are not in the same trace. The chain between producer and consumer is independent, as shown in the diagram, when I make additional http requests within the consumer code. I think these other business operations in consumer will not affect the tracing context, maybe I have overlooked something, please kindly give me your advice
<img width="500" alt="image" src="https://github.com/apache/skywalking-go/assets/66550292/314b60ae-f3a3-44f3-bc48-ea75dbe3832f">
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1940681919
The use case should be
1. A produces a message
2. B consumes the message
3. B uses this message to continue the processes.
These three should be in one trace. If 1 and 2 are, 3 is not, it means you miss one local span to wrap the 2 and 3 in a context. Java agent plugin should have covered this case.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488807930
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:
during development, I encountered the same problem as before https://github.com/apache/skywalking-go/pull/165#issuecomment-1935516907, so this time I tried to uninstall the trigger hook outside http
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488844787
##########
plugins/rocketmq/producer/send_one_way.go:
##########
@@ -0,0 +1,42 @@
+// 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 producer
+
+import (
+ "github.com/apache/skywalking-go/plugins/core/operator"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+)
+
+type SendOneWayInterceptor struct {
+}
+
+func (s *SendOneWayInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+ return SimpleProducerInterceptor(invocation)
Review Comment:
Sure, this name is good.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1490579653
##########
plugins/rocketmq/consumer/consumer.go:
##########
@@ -0,0 +1,92 @@
+// 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 consumer
+
+import (
+ "strings"
+
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/skywalking-go/plugins/core/tracing"
+
+ "github.com/apache/skywalking-go/plugins/core/operator"
+)
+
+const (
+ rmqConsumerComponentID = 39
+ rmqConsumerPrefix = "RocketMQ/"
+ rmqConsumerSuffix = "/Consumer"
+ tagMQMsgID = "mq.msg.id"
+ tagMQOffsetMsgID = "mq.offset.msg.id"
+ semicolon = ";"
+)
+
+type SwConsumerInterceptor struct {
+}
+
+func (c *SwConsumerInterceptor) BeforeInvoke(invocation operator.Invocation) error {
+ pushConsumer := invocation.CallerInstance().(*nativepushConsumer)
+ peer := strings.Join(pushConsumer.client.GetNameSrv().AddrList(), semicolon)
+ subMsgs := invocation.Args()[1].([]*primitive.MessageExt)
+ if len(subMsgs) == 0 {
+ return nil
+ }
+ topic, addr := subMsgs[0].Topic, subMsgs[0].StoreHost
+ operationName := rmqConsumerPrefix + topic + rmqConsumerSuffix
+
+ var (
+ span tracing.Span
+ err error
+ )
+ for _, msg := range subMsgs {
+ span, err = tracing.CreateEntrySpan(operationName, func(headerKey string) (string, error) {
+ return msg.GetProperty(headerKey), nil
+ },
+ tracing.WithLayer(tracing.SpanLayerMQ),
+ tracing.WithComponent(rmqConsumerComponentID),
+ tracing.WithTag(tagMQMsgID, msg.MsgId),
+ tracing.WithTag(tagMQOffsetMsgID, msg.OffsetMsgId),
+ )
+ if err != nil {
+ return err
+ }
+ }
+ span.Tag(tracing.TagMQTopic, topic)
Review Comment:
done
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu merged PR #169:
URL: https://github.com/apache/skywalking-go/pull/169
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1945593103
Sorry for the recurring problem on CI/Tests. My `golangci-lint` attempt on the local mac seems to be inconsistent with that on github. Is there any additional configuration required besides `make lint`?
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1490578962
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:
very sorry, I have been stuck on this question for a long time, based on Teacher Wu and your suggestions, I have tried it like this, the UI is displayed as follows
<img width="400" alt="image" src="https://github.com/apache/skywalking-go/assets/66550292/44a7a18e-7025-4a66-a7e5-d3855e03df1f">
[excepted.yml](test/plugins/scenarios/rocketmq/config/excepted.yml), If there are still problems, please prompt me with more info, thanks
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#issuecomment-1940448316
Could you confirm, is the further process driven by the message going to be in the same context?
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488807930
##########
test/plugins/scenarios/rocketmq/main.go:
##########
@@ -0,0 +1,246 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/apache/rocketmq-client-go/v2"
+ "github.com/apache/rocketmq-client-go/v2/consumer"
+ "github.com/apache/rocketmq-client-go/v2/primitive"
+ "github.com/apache/rocketmq-client-go/v2/producer"
+
+ _ "github.com/apache/skywalking-go"
+)
+
+type testFunc func() error
+
+const (
+ uri = "http://mqnamesrv:9876"
+ retry = 2
+ topic = "sw-topic"
+ group = "sw-group"
+ msg = "I love skywalking %s thousand"
+)
+
+func main() {
+ route := http.NewServeMux()
+ route.HandleFunc("/execute", func(res http.ResponseWriter, req *http.Request) {
+ _, _ = res.Write([]byte("execute success"))
+ })
+ route.HandleFunc("/health", func(writer http.ResponseWriter, request *http.Request) {
+ _, _ = writer.Write([]byte("ok"))
+ })
+
+ TestProCon()
Review Comment:
Because I encountered the same problem before during development https://github.com/apache/skywalking-go/pull/165#issuecomment-1935516907
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feature: add support for rocketMQ [skywalking-go]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on code in PR #169:
URL: https://github.com/apache/skywalking-go/pull/169#discussion_r1488849538
##########
test/plugins/scenarios/rocketmq/config/excepted.yml:
##########
@@ -0,0 +1,181 @@
+# 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: rocketmq
+ segmentSize: ge 9
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.topic, value: not null }
+ - { key: mq.status, value: not null }
+ - { key: mq.queue, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Consumer
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 39
+ isError: false
+ spanType: Entry
+ peer: http://mqnamesrv:9876
+ skipAnalysis: false
+ tags:
+ - { key: mq.msg.id, value: not null }
+ - { key: mq.offset.msg.id, value: not null }
+ - { key: mq.topic, value: not null }
+ - { key: mq.broker, value: not null }
+ - { key: mq.status, value: not null }
+ refs:
+ - { parentEndpoint: RocketMQ/sw-topic/Producer, networkAddress: 'http://mqnamesrv:9876',
+ refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: rocketmq,
+ traceId: not null }
+ - segmentId: not null
+ spans:
+ - operationName: RocketMQ/sw-topic/Producer/Callback
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: MQ
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 38
+ isError: false
+ spanType: Exit
Review Comment:
[async](https://github.com/apache/skywalking-go/pull/169/files#diff-cbae1ae787d2022d1035230dccde1263fff109b1d98c4bab947b0e9259bd4da1R42) My understanding of rocketMQ's Async is that after the producer sends the data, I create an Exit and do not need to wait for the return, instead, receive the server response through the callback interface, at this time, I create a Local span to represent the result of the callback
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org