File tree 5 files changed +32
-8
lines changed
apm-sniffer/apm-sdk-plugin/kafka-v1-plugin/src/main/java/org/apache/skywalking/apm/plugin/kafka/v1/define
5 files changed +32
-8
lines changed Original file line number Diff line number Diff line change
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 .v1 .define ;
20
+
21
+ import org .apache .skywalking .apm .agent .core .plugin .interceptor .enhance .ClassInstanceMethodsEnhancePluginDefine ;
22
+
23
+ public abstract class AbstractKafkaInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
24
+
25
+ @ Override protected String [] witnessClasses () {
26
+ return new String []{"org.apache.kafka.clients.ApiVersions" };
27
+ }
28
+ }
Original file line number Diff line number Diff line change 22
22
import net .bytebuddy .matcher .ElementMatcher ;
23
23
import org .apache .skywalking .apm .agent .core .plugin .interceptor .ConstructorInterceptPoint ;
24
24
import org .apache .skywalking .apm .agent .core .plugin .interceptor .InstanceMethodsInterceptPoint ;
25
- import org .apache .skywalking .apm .agent .core .plugin .interceptor .enhance .ClassInstanceMethodsEnhancePluginDefine ;
26
25
import org .apache .skywalking .apm .agent .core .plugin .match .ClassMatch ;
27
26
28
27
import static net .bytebuddy .matcher .ElementMatchers .named ;
29
28
import static org .apache .skywalking .apm .agent .core .plugin .match .HierarchyMatch .byHierarchyMatch ;
30
29
31
- public class CallbackInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
30
+ public class CallbackInstrumentation extends AbstractKafkaInstrumentation {
32
31
33
32
public static final String ENHANCE_CLASS = "org.apache.kafka.clients.producer.Callback" ;
34
33
public static final String ENHANCE_METHOD = "onCompletion" ;
Original file line number Diff line number Diff line change 22
22
import net .bytebuddy .matcher .ElementMatcher ;
23
23
import org .apache .skywalking .apm .agent .core .plugin .interceptor .ConstructorInterceptPoint ;
24
24
import org .apache .skywalking .apm .agent .core .plugin .interceptor .InstanceMethodsInterceptPoint ;
25
- import org .apache .skywalking .apm .agent .core .plugin .interceptor .enhance .ClassInstanceMethodsEnhancePluginDefine ;
26
25
import org .apache .skywalking .apm .agent .core .plugin .match .ClassMatch ;
27
26
28
27
import static net .bytebuddy .matcher .ElementMatchers .named ;
41
40
*
42
41
* @author zhang xin
43
42
*/
44
- public class KafkaConsumerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
43
+ public class KafkaConsumerInstrumentation extends AbstractKafkaInstrumentation {
45
44
46
45
public static final String CONSTRUCTOR_INTERCEPT_TYPE = "org.apache.kafka.clients.consumer.ConsumerConfig" ;
47
46
public static final String CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.kafka.v1.ConsumerConstructorInterceptor" ;
Original file line number Diff line number Diff line change 22
22
import net .bytebuddy .matcher .ElementMatcher ;
23
23
import org .apache .skywalking .apm .agent .core .plugin .interceptor .ConstructorInterceptPoint ;
24
24
import org .apache .skywalking .apm .agent .core .plugin .interceptor .InstanceMethodsInterceptPoint ;
25
- import org .apache .skywalking .apm .agent .core .plugin .interceptor .enhance .ClassInstanceMethodsEnhancePluginDefine ;
26
25
import org .apache .skywalking .apm .agent .core .plugin .match .ClassMatch ;
27
26
28
27
import static net .bytebuddy .matcher .ElementMatchers .named ;
42
41
*
43
42
* @author zhang xin
44
43
*/
45
- public class KafkaProducerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
44
+ public class KafkaProducerInstrumentation extends AbstractKafkaInstrumentation {
46
45
47
46
public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.kafka.v1.KafkaProducerInterceptor" ;
48
47
public static final String ENHANCE_CLASS = "org.apache.kafka.clients.producer.KafkaProducer" ;
Original file line number Diff line number Diff line change 22
22
import net .bytebuddy .matcher .ElementMatcher ;
23
23
import org .apache .skywalking .apm .agent .core .plugin .interceptor .ConstructorInterceptPoint ;
24
24
import org .apache .skywalking .apm .agent .core .plugin .interceptor .InstanceMethodsInterceptPoint ;
25
- import org .apache .skywalking .apm .agent .core .plugin .interceptor .enhance .ClassInstanceMethodsEnhancePluginDefine ;
26
25
import org .apache .skywalking .apm .agent .core .plugin .match .ClassMatch ;
27
26
28
27
import static net .bytebuddy .matcher .ElementMatchers .takesArguments ;
29
28
import static org .apache .skywalking .apm .agent .core .plugin .match .NameMatch .byName ;
30
29
31
- public class ProducerRecordInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
30
+ public class ProducerRecordInstrumentation extends AbstractKafkaInstrumentation {
32
31
33
32
public static final String CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.kafka.v1.ProducerRecordConstructorInterceptor" ;
34
33
public static final String ENHANCE_CLASS = "org.apache.kafka.clients.producer.ProducerRecord" ;
You can’t perform that action at this time.
0 commit comments