Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
wxbty committed Mar 31, 2024
2 parents 4d4b744 + ba76f04 commit 99563c9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 20 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/dyj.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,13 @@ jobs:
echo "CANDIDATE_VERSIONS=$CANDIDATE_VERSIONS" >> $GITHUB_ENV
- name: "Download Skywalking Agent And Mysql Driver"
run: |
wget -c https://archive.apache.org/dist/skywalking/java-agent/9.0.0/apache-skywalking-java-agent-9.0.0.tgz --no-check-certificate
tar -zxvf apache-skywalking-java-agent-9.0.0.tgz -C /tmp
wget -c https://archive.apache.org/dist/skywalking/java-agent/9.1.0/apache-skywalking-java-agent-9.1.0.tgz --no-check-certificate
tar -zxvf apache-skywalking-java-agent-9.1.0.tgz -C /tmp
wget -c https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.23/mysql-connector-java-8.0.23.jar
mv mysql-connector-java-8.0.23.jar /tmp/
cd 10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent && mvn clean package
rm /tmp/skywalking-agent/plugins/*
cp ./target/dubbo-samples-benchmark-agent.jar /tmp/skywalking-agent/plugins/
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
Expand Down
4 changes: 3 additions & 1 deletion 10-task/dubbo-samples-benchmark/case-configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ services:
retries: 20

skywalking:
image: apache/skywalking-oap-server:9.0.0
image: apache/skywalking-oap-server:9.1.0
hostname: skywalking
ports:
- 11800:11800
- 12800:12800
volumes:
- /tmp/mysql-connector-java-8.0.23.jar:/skywalking/oap-libs/mysql-connector-java-8.0.23.jar
environment:
Expand All @@ -52,6 +53,7 @@ services:
- bh-mysql:3306
depends_on:
- bh-mysql

provider:
type: app
basedir: dubbo-samples-benchmark-provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
<version>9.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>9.1.0</version>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,35 @@
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.MultiClassNameMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.logical.LogicalMatchOperation;
import org.apache.skywalking.apm.dependencies.net.bytebuddy.description.method.MethodDescription;
import org.apache.skywalking.apm.dependencies.net.bytebuddy.matcher.ElementMatcher;

import static org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch.byHierarchyMatch;
import static org.apache.skywalking.apm.agent.core.plugin.match.PrefixMatch.nameStartsWith;
import static org.apache.skywalking.apm.dependencies.net.bytebuddy.matcher.ElementMatchers.namedOneOf;

public class CustomizeDubboInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {

public static final String INTERCEPT_POINT_METHOD = "doInvoke";
public static final String INTERCEPT_INVOKE_METHOD = "invoke";
private static final String RPC_INVOKER = "org.apache.dubbo.rpc.protocol.AbstractInvoker";

private static final String RemoteInvocation = "org.springframework.remoting.support.RemoteInvocation";

private static final String Serialization = "org.apache.dubbo.common.serialize.Serialization";

public static final String InvokerInvocationHandler = "org.apache.dubbo.rpc.proxy.InvokerInvocationHandler";

public static final String DemoService = "org.apache.dubbo.benchmark.demo.DemoService";

private static final String RPC_INVOKER = "org.apache.dubbo.rpc.Invoker";
public static final String INTERCEPT_CLASS = "org.apache.dubbo.benchmark.agent.DubboInvokeInterceptor";

@Override
protected ClassMatch enhanceClass() {
return LogicalMatchOperation.and(nameStartsWith("org.apache.dubbo"), byHierarchyMatch(RPC_INVOKER));
return LogicalMatchOperation.or(byHierarchyMatch(RemoteInvocation)
, byHierarchyMatch(RPC_INVOKER)
, byHierarchyMatch(Serialization)
, byHierarchyMatch(DemoService)
, MultiClassNameMatch.byMultiClassMatch(InvokerInvocationHandler));
}

@Override
Expand All @@ -54,7 +64,7 @@ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
new InstanceMethodsInterceptPoint() {
@Override
public ElementMatcher<MethodDescription> getMethodsMatcher() {
return namedOneOf(INTERCEPT_POINT_METHOD, INTERCEPT_INVOKE_METHOD);
return namedOneOf("doInvoke", "invoke", "serialize", "deserialize", "sayHello");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public class DubboInvokeInterceptor implements InstanceMethodsAroundInterceptor
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
MethodInterceptResult result) {
String operationName = MethodUtil.generateOperationName(method);
ContextManager.createLocalSpan(operationName);

ContextManager.createLocalSpan(MethodUtil.generateOperationName(method));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.results.format.ResultFormatType;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
Expand Down Expand Up @@ -85,13 +86,13 @@ public void test() throws RunnerException {
.include(MyBenchmark.class.getSimpleName())
.param("time", System.currentTimeMillis() + "")
.param("prop", propJson == null ? "" : propJson)
.warmupIterations(1)
.warmupIterations(5)
.warmupTime(TimeValue.seconds(1))
.measurementIterations(1)
.measurementIterations(5)
.measurementTime(TimeValue.seconds(1))
.mode(Mode.AverageTime)
.timeUnit(TimeUnit.MILLISECONDS)
.threads(16)
.threads(Threads.MAX)
.forks(1);

options = doOptions(optBuilder, prop).build();
Expand Down
5 changes: 5 additions & 0 deletions 10-task/dubbo-samples-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@
<version>2.7.23</version>
</dependency>

<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>9.1.0</version>
</dependency>
</dependencies>


Expand Down

0 comments on commit 99563c9

Please sign in to comment.