Skip to content

Commit 6621f82

Browse files
authored
add RocketMQ 5.x plugin (#536)
1 parent 5002da5 commit 6621f82

31 files changed

Lines changed: 1174 additions & 11 deletions

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Release Notes.
88
* Support Jdk17 ZGC metric collect
99
* Support Jetty 11.x plugin
1010
* Fix the scenario of using the HBase plugin with spring-data-hadoop.
11+
* Add RocketMQ 5.x plugin
1112

1213
#### Documentation
1314

apm-sniffer/apm-sdk-plugin/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
<module>jersey-3.x-plugin</module>
132132
<module>grizzly-2.3.x-4.x-plugin</module>
133133
<module>grizzly-2.3.x-4.x-work-threadpool-plugin</module>
134+
<module>rocketMQ-5.x-plugin</module>
134135
</modules>
135136
<packaging>pom</packaging>
136137

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.skywalking.apm.plugin.rocketMQ.v4.define;
20+
21+
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
22+
23+
public abstract class AbstractRocketMQInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
24+
25+
@Override
26+
protected String[] witnessClasses() {
27+
return new String[] {Constants.WITNESS_ROCKETMQ_4X_CLASS};
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
package org.apache.skywalking.apm.plugin.rocketMQ.v4.define;
20+
21+
public class Constants {
22+
23+
public static final String WITNESS_ROCKETMQ_4X_CLASS = "org.apache.rocketmq.common.protocol.header.SendMessageRequestHeader";
24+
}

apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/define/ConsumeMessageConcurrentlyInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
import net.bytebuddy.matcher.ElementMatcher;
2323
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
2424
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
25-
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
2625
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
2726
import org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch;
2827

2928
import static net.bytebuddy.matcher.ElementMatchers.named;
3029

31-
public class ConsumeMessageConcurrentlyInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
30+
public class ConsumeMessageConcurrentlyInstrumentation extends AbstractRocketMQInstrumentation {
3231
private static final String ENHANCE_CLASS = "org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently";
3332
private static final String CONSUMER_MESSAGE_METHOD = "consumeMessage";
3433
private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.rocketMQ.v4.MessageConcurrentlyConsumeInterceptor";

apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/define/ConsumeMessageOrderlyInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
import net.bytebuddy.matcher.ElementMatcher;
2323
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
2424
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
25-
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
2625
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
2726

2827
import static net.bytebuddy.matcher.ElementMatchers.named;
2928
import static org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch.byHierarchyMatch;
3029

31-
public class ConsumeMessageOrderlyInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
30+
public class ConsumeMessageOrderlyInstrumentation extends AbstractRocketMQInstrumentation {
3231
private static final String ENHANCE_CLASS = "org.apache.rocketmq.client.consumer.listener.MessageListenerOrderly";
3332
private static final String ENHANCE_METHOD = "consumeMessage";
3433
private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.rocketMQ.v4.MessageOrderlyConsumeInterceptor";

apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/define/DefaultMQPushConsumerInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
import net.bytebuddy.matcher.ElementMatcher;
2323
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
2424
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
25-
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
2625
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
2726

2827
import static net.bytebuddy.matcher.ElementMatchers.named;
2928
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
3029

31-
public class DefaultMQPushConsumerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
30+
public class DefaultMQPushConsumerInstrumentation extends AbstractRocketMQInstrumentation {
3231

3332
private static final String ENHANCE_CLASS = "org.apache.rocketmq.client.consumer.DefaultMQPushConsumer";
3433
private static final String REGISTER_MESSAGE_LISTENER_METHOD_NAME = "registerMessageListener";

apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/define/MQClientAPIImplInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
import net.bytebuddy.matcher.ElementMatcher;
2323
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
2424
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
25-
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
2625
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
2726

2827
import static net.bytebuddy.matcher.ElementMatchers.named;
2928
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
3029
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
3130

32-
public class MQClientAPIImplInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
31+
public class MQClientAPIImplInstrumentation extends AbstractRocketMQInstrumentation {
3332

3433
private static final String ENHANCE_CLASS = "org.apache.rocketmq.client.impl.MQClientAPIImpl";
3534
private static final String SEND_MESSAGE_METHOD_NAME = "sendMessage";

apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/define/SendCallbackInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
import net.bytebuddy.matcher.ElementMatcher;
2323
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
2424
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
25-
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
2625
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
2726

2827
import static net.bytebuddy.matcher.ElementMatchers.named;
2928
import static org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
3029
import static org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch.byHierarchyMatch;
3130

32-
public class SendCallbackInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
31+
public class SendCallbackInstrumentation extends AbstractRocketMQInstrumentation {
3332

3433
private static final String ENHANCE_CLASS = "org.apache.rocketmq.client.producer.SendCallback";
3534
private static final String ON_SUCCESS_ENHANCE_METHOD = "onSuccess";
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
~
18+
-->
19+
20+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<parent>
22+
<artifactId>apm-sdk-plugin</artifactId>
23+
<groupId>org.apache.skywalking</groupId>
24+
<version>8.17.0-SNAPSHOT</version>
25+
</parent>
26+
<modelVersion>4.0.0</modelVersion>
27+
28+
<artifactId>apm-rocketMQ-5.x-plugin</artifactId>
29+
<name>rocketMQ-5.x-plugin</name>
30+
31+
<properties>
32+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
33+
<rocketmq-client.version>5.1.1</rocketmq-client.version>
34+
</properties>
35+
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.apache.rocketmq</groupId>
39+
<artifactId>rocketmq-client</artifactId>
40+
<version>${rocketmq-client.version}</version>
41+
<scope>provided</scope>
42+
</dependency>
43+
</dependencies>
44+
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<artifactId>maven-deploy-plugin</artifactId>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
53+
</project>

0 commit comments

Comments
 (0)