Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/plugins-test.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
- correlation-autotag-scenario
- dubbo-2.5.x-scenario
- dubbo-2.7.x-scenario
- dubbo-3.x-scenario
- ehcache-2.x-scenario
- elasticsearch-5.x-scenario
- elasticsearch-6.x-scenario
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release Notes.
* Avoid `ProfileTaskChannelService.addProfilingSnapshot` throw IllegalStateException(Queue full)
* Increase `ProfileTaskChannelService.snapshotQueue` default size from 50 to 4500
* Support 2.8 and 2.9 of pulsar client.
* Add dubbo 3.x plugin.

#### Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;

import java.util.Collections;
import java.util.List;

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

/**
Expand All @@ -35,6 +40,11 @@
* to ensure the correct compilation of the code.
*/
public class WrapperInstrumentation extends ClassStaticMethodsEnhancePluginDefine {

private static final String CONTEXT_TYPE_NAME = "org.apache.dubbo.rpc.RpcContext";

private static final String GET_SERVER_CONTEXT_METHOD_NAME = "getServerContext";

@Override
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
return new StaticMethodsInterceptPoint[] {
Expand All @@ -61,4 +71,14 @@ public boolean isOverrideArgs() {
protected ClassMatch enhanceClass() {
return byName("org.apache.dubbo.common.bytecode.Wrapper");
}

@Override
protected List<WitnessMethod> witnessMethods() {
return Collections.singletonList(new WitnessMethod(
CONTEXT_TYPE_NAME,
named(GET_SERVER_CONTEXT_METHOD_NAME).and(
returns(named(CONTEXT_TYPE_NAME)))
));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

dubbo=org.apache.skywalking.apm.plugin.asf.dubbo.patch.WrapperInstrumentation
dubbo-2.7.x=org.apache.skywalking.apm.plugin.asf.dubbo.patch.WrapperInstrumentation
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,29 @@

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;

import java.util.Collections;
import java.util.List;

import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.returns;

public class DubboInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {

private static final String ENHANCE_CLASS = "org.apache.dubbo.monitor.support.MonitorFilter";

private static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.asf.dubbo.DubboInterceptor";

private static final String CONTEXT_TYPE_NAME = "org.apache.dubbo.rpc.RpcContext";

private static final String GET_SERVER_CONTEXT_METHOD_NAME = "getServerContext";

@Override
protected ClassMatch enhanceClass() {
return NameMatch.byName(ENHANCE_CLASS);
Expand Down Expand Up @@ -65,4 +74,14 @@ public boolean isOverrideArgs() {
}
};
}

@Override
protected List<WitnessMethod> witnessMethods() {
return Collections.singletonList(new WitnessMethod(
CONTEXT_TYPE_NAME,
named(GET_SERVER_CONTEXT_METHOD_NAME).and(
returns(named(CONTEXT_TYPE_NAME)))
));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

dubbo=org.apache.skywalking.apm.plugin.asf.dubbo.DubboInstrumentation
dubbo-2.7.x=org.apache.skywalking.apm.plugin.asf.dubbo.DubboInstrumentation
44 changes: 44 additions & 0 deletions apm-sniffer/apm-sdk-plugin/dubbo-3.x-conflict-patch/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<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">
<parent>
<artifactId>apm-sdk-plugin</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>8.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dubbo-3.x-conflict-patch</artifactId>

<name>apm-dubbo-3.x-conflict-path</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dubbo.version>3.0.0</dubbo.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Loading