From a4833b1b777a504f2424e4aecbe7cff796ca9f2e Mon Sep 17 00:00:00 2001 From: xubinghao <786991884@qq.com> Date: Thu, 7 Dec 2023 20:11:49 +0800 Subject: [PATCH 1/5] Support forkjoinpool plugin in JDK11 --- .../define/ForkJoinWorkerQueueInstrumentation.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java index 9477b4b6fb..e7cfddc9a4 100644 --- a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java +++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java @@ -19,6 +19,7 @@ package org.apache.skywalking.apm.plugin.jdk.forkjoinpool.define; import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.matcher.ElementMatcher; @@ -33,6 +34,9 @@ public class ForkJoinWorkerQueueInstrumentation extends ClassInstanceMethodsEnha private static final String FORK_JOIN_WORKER_QUEUE_CLASS = "java.util.concurrent.ForkJoinPool$WorkQueue"; private static final String FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD = "runTask"; + + private static final String FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD_JDK11 = "topLevelExec"; + private static final String FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jdk.forkjoinpool.ForkJoinWorkerQueueMethodInterceptor"; @Override @@ -51,7 +55,7 @@ public InstanceMethodsInterceptV2Point[] getInstanceMethodsInterceptV2Points() { new InstanceMethodsInterceptV2Point() { @Override public ElementMatcher getMethodsMatcher() { - return named(FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD); + return namedOneOf(FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD, FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD_JDK11); } @Override From 0416268646c523f5c57849828609ca536d118f7c Mon Sep 17 00:00:00 2001 From: xubinghao <786991884@qq.com> Date: Sat, 9 Dec 2023 20:52:35 +0800 Subject: [PATCH 2/5] Support forkjoinpool plugin in JDK11 --- CHANGES.md | 1 + .../forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 0029a64980..936fa9106e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ Release Notes. 9.2.0 ------------------ +* fix forkjoinpool plugin in JDK11 #### Documentation diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java index e7cfddc9a4..8286c5cd36 100644 --- a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java +++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java @@ -18,7 +18,6 @@ package org.apache.skywalking.apm.plugin.jdk.forkjoinpool.define; -import static net.bytebuddy.matcher.ElementMatchers.named; import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; import net.bytebuddy.description.method.MethodDescription; From 56893b6328d48f3078dfafb74656948cfe179d7a Mon Sep 17 00:00:00 2001 From: xubinghao <786991884@qq.com> Date: Mon, 11 Dec 2023 09:56:34 +0800 Subject: [PATCH 3/5] Support forkjoinpool plugin in JDK11 --- .github/workflows/plugins-jdk11-test.3.yaml | 130 ++++++++++++++++++ .../bin/startup.sh | 21 +++ .../config/expectedData.yaml | 85 ++++++++++++ .../configuration.yml | 23 ++++ .../jdk11-forkjoinpool-scenario/pom.xml | 121 ++++++++++++++++ .../src/main/assembly/assembly.xml | 41 ++++++ .../jdk/forkjoinpool/Application.java | 34 +++++ .../controller/CaseController.java | 61 ++++++++ .../src/main/resources/application.yaml | 23 ++++ .../src/main/resources/log4j2.xml | 30 ++++ .../support-version.list | 17 +++ 11 files changed, 586 insertions(+) create mode 100644 .github/workflows/plugins-jdk11-test.3.yaml create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/bin/startup.sh create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/configuration.yml create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/Application.java create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/controller/CaseController.java create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/application.yaml create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/log4j2.xml create mode 100644 test/plugin/scenarios/jdk11-forkjoinpool-scenario/support-version.list diff --git a/.github/workflows/plugins-jdk11-test.3.yaml b/.github/workflows/plugins-jdk11-test.3.yaml new file mode 100644 index 0000000000..f030510ef0 --- /dev/null +++ b/.github/workflows/plugins-jdk11-test.3.yaml @@ -0,0 +1,130 @@ +# 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. + +name: Test + +on: + pull_request: + paths: + - '.github/workflows/plugins-*.yaml' + - 'apm-application-toolkit/**' + - 'apm-commons/**' + - 'apm-protocol/**' + - 'apm-sniffer/**' + - 'test/plugin/**' + - '**/pom.xml' + - '!**.md' + +concurrency: + group: plugins-3-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Build + uses: ./.github/actions/build + + test: + needs: [ build ] + name: ${{ matrix.case }} + runs-on: ubuntu-latest + timeout-minutes: 90 + strategy: + matrix: + case: + - aerospike-scenario + - mysql-scenario + - undertow-scenario + - webflux-scenario + - zookeeper-scenario + - spring-3.1.x-scenario + - spring-4.1.x-scenario + - spring-4.3.x-scenario + - spring-async-scenario + - vertx-core-4.x-scenario + - vertx-eventbus-3.x-scenario + - vertx-web-3.54minus-scenario + - vertx-web-3.6plus-scenario + - mariadb-scenario + - micronaut-http-scenario + - nats-2.14.x-2.15.x-scenario + - quasar-scenario + - baidu-brpc-scenario + - baidu-brpc-3.x-scenario + - retransform-class-scenario + - retransform-class-tomcat-scenario + - graphql-8.x-scenario + - graphql-9.x-scenario + - graphql-16plus-scenario + - graphql-12.x-15.x-scenario + - hbase-scenario + - spring-kafka-1.3.x-scenario + - spring-kafka-2.2.x-scenario + - spring-kafka-2.3.x-scenario + - spring-scheduled-scenario + - elasticjob-2.x-scenario + - quartz-scheduler-2.x-scenario + - xxl-job-2.2.0-scenario + - xxl-job-2.3.x-scenario + - thrift-scenario + - dbcp-2.x-scenario + - jsonrpc4j-1.x-scenario + - gateway-3.x-scenario + - gateway-3.x-filter-context-scenario + - neo4j-4.x-scenario + - oracle-scenario + - druid-1.x-scenario + - hikaricp-scenario + - clickhouse-0.3.1-scenario + - clickhouse-0.3.2.x-scenario + - kylin-jdbc-2.6.x-3.x-4.x-scenario + - undertow-worker-thread-pool-scenario + - tomcat-thread-pool-scenario + - guava-eventbus-scenario + - shenyu-2.4.x-scenario + - jdk-threadpool-scenario + - jdk-forkjoinpool-scenario + - shenyu-2.4.x-dubbo-scenario + - grpc-generic-call-scenario + - shenyu-2.4.x-grpc-scenario + - shenyu-2.4.x-sofarpc-scenario + - impala-jdbc-2.6.x-scenario + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 11 + - name: Install Oracle Libs + if: matrix.case == 'oracle-scenario' + run: | + mkdir -p skywalking-agent/plugins + curl -O https://skyapm.github.io/ci-assist/jars/ojdbc14-10.2.0.4.0.jar + curl -L -o ./skywalking-agent/plugins/apm-oracle-10.x-plugin-2.3.1.jar https://github.com/SkyAPM/java-plugin-extensions/releases/download/2.3.1/apm-oracle-10.x-plugin-2.3.1.jar + ./mvnw -q --batch-mode install:install-file -Dfile=ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar + - name: Run Plugin Test + uses: ./.github/actions/run + with: + test_case: ${{ matrix.case }} diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/bin/startup.sh b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/bin/startup.sh new file mode 100644 index 0000000000..11f11c536f --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/bin/startup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# 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. + +home="$(cd "$(dirname $0)"; pwd)" + +java -jar ${agent_opts} ${home}/../libs/jdk11-forkjoinpool-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/config/expectedData.yaml new file mode 100644 index 0000000000..c255d35691 --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/config/expectedData.yaml @@ -0,0 +1,85 @@ +# 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. +segmentItems: +- serviceName: jdk11-forkjoinpool-scenario + segmentSize: ge 3 + segments: + - segmentId: not null + spans: + - operationName: '/apache/skywalking' + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + isError: false + spanType: Exit + peer: 'github.com:443' + tags: + - {key: url, value: 'https://github.com/apache/skywalking'} + - {key: http.method, value: GET} + - {key: http.status_code, value: '200'} + skipAnalysis: 'false' + - operationName: 'ForkJoinPool/java.util.concurrent.ForkJoinPool$WorkQueue/topLevelExec' + parentSpanId: -1 + spanId: 0 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 80 + isError: false + spanType: Local + peer: '' + refs: + - {parentEndpoint: 'GET:/jdk11-forkjoinpool-scenario/case/jdk11-forkjoinpool-scenario', networkAddress: '', refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not + null, parentService: jdk11-forkjoinpool-scenario, traceId: not null} + skipAnalysis: 'false' + - segmentId: not null + spans: + - operationName: '/apache/skywalking' + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + isError: false + spanType: Exit + peer: 'github.com:443' + tags: + - {key: url, value: 'https://github.com/apache/skywalking'} + - {key: http.method, value: GET} + - {key: http.status_code, value: '200'} + skipAnalysis: 'false' + - operationName: 'GET:/jdk11-forkjoinpool-scenario/case/jdk11-forkjoinpool-scenario' + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + isError: false + spanType: Entry + tags: + - {key: url, value: 'http://localhost:8080/jdk11-forkjoinpool-scenario/case/jdk11-forkjoinpool-scenario'} + - {key: http.method, value: GET} + - {key: http.status_code, value: '200'} + peer: '' + skipAnalysis: 'false' + + diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/configuration.yml b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/configuration.yml new file mode 100644 index 0000000000..2fd7c0dbda --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/configuration.yml @@ -0,0 +1,23 @@ +# 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. + +type: jvm +entryService: http://localhost:8080/jdk11-forkjoinpool-scenario/case/jdk11-forkjoinpool-scenario +healthCheck: http://localhost:8080/jdk11-forkjoinpool-scenario/case/healthCheck +runningMode: with_bootstrap +withPlugins: apm-jdk-forkjoinpool-plugin-*.jar +startScript: ./bin/startup.sh + diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml new file mode 100644 index 0000000000..1153cc2516 --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml @@ -0,0 +1,121 @@ + + + + + org.apache.skywalking.apm.testcase + jdk11-forkjoinpool-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + 3.8.1 + YOUR VERSION + 2.1.6.RELEASE + 1.18.20 + + + skywalking-jdk11-forkjoinpool-scenario + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + jdk11-forkjoinpool-scenario + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + + + repackage + + + + + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemble + package + + single + + + + src/main/assembly/assembly.xml + + ./target/ + + + + + + + diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/assembly/assembly.xml new file mode 100644 index 0000000000..ab4f759403 --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/jdk11-forkjoinpool-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/Application.java b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/Application.java new file mode 100644 index 0000000000..a726ec9cf9 --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/Application.java @@ -0,0 +1,34 @@ +/* + * 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. + * + */ + +package org.apache.skywalking.apm.testcase.jdk.forkjoinpool; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + try { + SpringApplication.run(Application.class, args); + } catch (Exception e) { + // Never do this + } + } +} diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/controller/CaseController.java b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/controller/CaseController.java new file mode 100644 index 0000000000..9fbd22634d --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/controller/CaseController.java @@ -0,0 +1,61 @@ +/* + * 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. + * + */ + +package org.apache.skywalking.apm.testcase.jdk.forkjoinpool.controller; + +import java.util.stream.IntStream; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +@RestController +@RequestMapping("/case") +@Log4j2 +public class CaseController { + + @Autowired + private RestTemplate restTemplate; + + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + private static final String SUCCESS = "Success"; + + @RequestMapping("/jdk11-forkjoinpool-scenario") + @ResponseBody + public String testcase() { + // your codes + IntStream.range(1, 3).parallel() + .forEach(num -> restTemplate.getForEntity("https://github.com/apache/skywalking", String.class)); + return SUCCESS; + } + + @RequestMapping("/healthCheck") + @ResponseBody + public String healthCheck() { + // your codes + return SUCCESS; + } + +} diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/application.yaml new file mode 100644 index 0000000000..26d3ccb338 --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/application.yaml @@ -0,0 +1,23 @@ +# +# 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. +# +# +server: + port: 8080 + servlet: + context-path: /jdk11-forkjoinpool-scenario +logging: + config: classpath:log4j2.xml \ No newline at end of file diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..9849ed5a8a --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/support-version.list b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/support-version.list new file mode 100644 index 0000000000..658e529523 --- /dev/null +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/support-version.list @@ -0,0 +1,17 @@ +# 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. + +all From bca00bed6518a709687ca9bfd4ef945585c7cb85 Mon Sep 17 00:00:00 2001 From: xubinghao <786991884@qq.com> Date: Mon, 11 Dec 2023 11:01:44 +0800 Subject: [PATCH 4/5] Support forkjoinpool plugin in JDK11 --- .github/workflows/plugins-jdk11-test.3.yaml | 67 +-------------------- 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/.github/workflows/plugins-jdk11-test.3.yaml b/.github/workflows/plugins-jdk11-test.3.yaml index f030510ef0..134d51fb09 100644 --- a/.github/workflows/plugins-jdk11-test.3.yaml +++ b/.github/workflows/plugins-jdk11-test.3.yaml @@ -29,7 +29,7 @@ on: - '!**.md' concurrency: - group: plugins-3-${{ github.event.pull_request.number || github.ref }} + group: plugins-jdk11-3-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: @@ -52,63 +52,7 @@ jobs: strategy: matrix: case: - - aerospike-scenario - - mysql-scenario - - undertow-scenario - - webflux-scenario - - zookeeper-scenario - - spring-3.1.x-scenario - - spring-4.1.x-scenario - - spring-4.3.x-scenario - - spring-async-scenario - - vertx-core-4.x-scenario - - vertx-eventbus-3.x-scenario - - vertx-web-3.54minus-scenario - - vertx-web-3.6plus-scenario - - mariadb-scenario - - micronaut-http-scenario - - nats-2.14.x-2.15.x-scenario - - quasar-scenario - - baidu-brpc-scenario - - baidu-brpc-3.x-scenario - - retransform-class-scenario - - retransform-class-tomcat-scenario - - graphql-8.x-scenario - - graphql-9.x-scenario - - graphql-16plus-scenario - - graphql-12.x-15.x-scenario - - hbase-scenario - - spring-kafka-1.3.x-scenario - - spring-kafka-2.2.x-scenario - - spring-kafka-2.3.x-scenario - - spring-scheduled-scenario - - elasticjob-2.x-scenario - - quartz-scheduler-2.x-scenario - - xxl-job-2.2.0-scenario - - xxl-job-2.3.x-scenario - - thrift-scenario - - dbcp-2.x-scenario - - jsonrpc4j-1.x-scenario - - gateway-3.x-scenario - - gateway-3.x-filter-context-scenario - - neo4j-4.x-scenario - - oracle-scenario - - druid-1.x-scenario - - hikaricp-scenario - - clickhouse-0.3.1-scenario - - clickhouse-0.3.2.x-scenario - - kylin-jdbc-2.6.x-3.x-4.x-scenario - - undertow-worker-thread-pool-scenario - - tomcat-thread-pool-scenario - - guava-eventbus-scenario - - shenyu-2.4.x-scenario - - jdk-threadpool-scenario - - jdk-forkjoinpool-scenario - - shenyu-2.4.x-dubbo-scenario - - grpc-generic-call-scenario - - shenyu-2.4.x-grpc-scenario - - shenyu-2.4.x-sofarpc-scenario - - impala-jdbc-2.6.x-scenario + - jdk11-forkjoinpool-scenario steps: - uses: actions/checkout@v2 with: @@ -117,13 +61,6 @@ jobs: with: distribution: temurin java-version: 11 - - name: Install Oracle Libs - if: matrix.case == 'oracle-scenario' - run: | - mkdir -p skywalking-agent/plugins - curl -O https://skyapm.github.io/ci-assist/jars/ojdbc14-10.2.0.4.0.jar - curl -L -o ./skywalking-agent/plugins/apm-oracle-10.x-plugin-2.3.1.jar https://github.com/SkyAPM/java-plugin-extensions/releases/download/2.3.1/apm-oracle-10.x-plugin-2.3.1.jar - ./mvnw -q --batch-mode install:install-file -Dfile=ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar - name: Run Plugin Test uses: ./.github/actions/run with: From 783e8e2126acb14a66500ac606e47c35e4ce922c Mon Sep 17 00:00:00 2001 From: xubinghao <786991884@qq.com> Date: Tue, 12 Dec 2023 10:06:09 +0800 Subject: [PATCH 5/5] Support forkjoinpool plugin in JDK11+ --- .github/workflows/plugins-jdk11-test.3.yaml | 2 ++ .../define/ForkJoinWorkerQueueInstrumentation.java | 10 +++++++++- .../scenarios/jdk11-forkjoinpool-scenario/pom.xml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/plugins-jdk11-test.3.yaml b/.github/workflows/plugins-jdk11-test.3.yaml index 134d51fb09..a1f90fff14 100644 --- a/.github/workflows/plugins-jdk11-test.3.yaml +++ b/.github/workflows/plugins-jdk11-test.3.yaml @@ -43,6 +43,8 @@ jobs: submodules: true - name: Build uses: ./.github/actions/build + with: + base_image_java: eclipse-temurin:11-jdk test: needs: [ build ] diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java index 8286c5cd36..97fc72d6f2 100644 --- a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java +++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java @@ -33,7 +33,15 @@ public class ForkJoinWorkerQueueInstrumentation extends ClassInstanceMethodsEnha private static final String FORK_JOIN_WORKER_QUEUE_CLASS = "java.util.concurrent.ForkJoinPool$WorkQueue"; private static final String FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD = "runTask"; - + + /** + * The runWorker method is one of the core methods of ForkJoinPool, + * responsible for retrieving tasks from the work queue and executing them. + *

+ * Within the runWorker method, it calls the scan method to search and execute tasks. + *

+ * in java11+ ForkJoinPool. scan calls WorkQueue.topLevelExec, in JAVA8 it calls WorkQueue.runTask. + */ private static final String FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD_JDK11 = "topLevelExec"; private static final String FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jdk.forkjoinpool.ForkJoinWorkerQueueMethodInterceptor"; diff --git a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml index 1153cc2516..07f2f32b1a 100644 --- a/test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml +++ b/test/plugin/scenarios/jdk11-forkjoinpool-scenario/pom.xml @@ -29,7 +29,7 @@ UTF-8 - 1.8 + 11 3.8.1 YOUR VERSION 2.1.6.RELEASE