Skip to content

Commit 67ab8b2

Browse files
authored
Support kafka-clients-3.9.x intercept and Upgrade kafka-clients version in optional-reporter-plugins to 3.9.1 (#780)
1 parent 53a00a6 commit 67ab8b2

File tree

7 files changed

+48
-2
lines changed

7 files changed

+48
-2
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Release Notes.
2020
* Eliminate repeated code with HttpServletRequestWrapper in mvc-annotation-commons.
2121
* Add the jdk httpclient plugin.
2222
* Fix Gateway 2.0.x plugin not activated for spring-cloud-starter-gateway 2.0.0.RELEASE.
23+
* Support kafka-clients-3.9.x intercept.
24+
* Upgrade kafka-clients version in optional-reporter-plugins to 3.9.1.
25+
2326
All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/242?closed=1)
2427

2528
------------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.kafka.define;
20+
21+
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
22+
23+
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
24+
25+
/**
26+
* For Kafka 3.9.x change
27+
*
28+
* <pre>
29+
* 1. The class named <code>LegacyKafkaConsumer</code> was rename to <code>ClassicKafkaConsumer</code>
30+
* 2. Because of the enhance class was changed, so we should create new Instrumentation to enhance the new class
31+
* </pre>
32+
*/
33+
public class ClassicKafkaConsumerInstrumentation extends KafkaConsumerInstrumentation {
34+
private static final String ENHANCE_CLASS_39_CLASSIC = "org.apache.kafka.clients.consumer.internals.ClassicKafkaConsumer";
35+
36+
@Override
37+
protected ClassMatch enhanceClass() {
38+
return byName(ENHANCE_CLASS_39_CLASSIC);
39+
}
40+
}

apm-sniffer/apm-sdk-plugin/kafka-plugin/src/main/resources/skywalking-plugin.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ kafka-0.11.x/1.x/2.x=org.apache.skywalking.apm.plugin.kafka.define.KafkaProducer
2121
kafka-0.11.x/1.x/2.x=org.apache.skywalking.apm.plugin.kafka.define.KafkaTemplateCallbackInstrumentation
2222
kafka-3.7.x=org.apache.skywalking.apm.plugin.kafka.define.Kafka37AsyncConsumerInstrumentation
2323
kafka-3.7.x=org.apache.skywalking.apm.plugin.kafka.define.Kafka37LegacyConsumerInstrumentation
24+
kafka-3.9.x=org.apache.skywalking.apm.plugin.kafka.define.ClassicKafkaConsumerInstrumentation

apm-sniffer/optional-reporter-plugins/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<ant-contrib.version>1.0b3</ant-contrib.version>
4242
<ant-nodeps.version>1.8.1</ant-nodeps.version>
4343

44-
<kafka-clients.version>2.4.1</kafka-clients.version>
44+
<kafka-clients.version>3.9.1</kafka-clients.version>
4545
<spring-kafka-test.version>2.4.6.RELEASE</spring-kafka-test.version>
4646
</properties>
4747

docs/en/setup/service-agent/java-agent/Plugin-list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
- jetty-server-9.x
5858
- kafka-0.11.x/1.x/2.x
5959
- kafka-3.7.x
60+
- kafka-3.9.x
6061
- kotlin-coroutine
6162
- lettuce-common
6263
- lettuce-5.x-6.4.x

docs/en/setup/service-agent/java-agent/Supported-list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ metrics based on the tracing data.
7676
* MQ
7777
* [RocketMQ](https://github.com/apache/rocketmq) 3.x-> 5.x
7878
* [RocketMQ-gRPC](http://github.com/apache/rocketmq-clients) 5.x
79-
* [Kafka](http://kafka.apache.org) 0.11.0.0 -> 3.7.1
79+
* [Kafka](http://kafka.apache.org) 0.11.0.0 -> 3.9.1
8080
* [Spring-Kafka](https://github.com/spring-projects/spring-kafka) Spring Kafka Consumer 1.3.x -> 2.3.x (2.0.x and 2.1.x not tested and not recommended by [the official document](https://spring.io/projects/spring-kafka))
8181
* [ActiveMQ](https://github.com/apache/activemq) 5.10.0 -> 5.15.4
8282
* [RabbitMQ](https://www.rabbitmq.com/) 3.x-> 5.x

test/plugin/scenarios/kafka-scenario/support-version.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@
3131
3.6.0
3232
3.7.0
3333
3.7.1
34+
3.9.1

0 commit comments

Comments
 (0)