You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/04/17 09:45:15 UTC

[skywalking-java] branch main updated: Support forkjoinpool plugin (#505)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git


The following commit(s) were added to refs/heads/main by this push:
     new 02dad132b2 Support forkjoinpool plugin (#505)
02dad132b2 is described below

commit 02dad132b2807cbecdb69c7c0fbce54d36bd6e3e
Author: xu1009 <29...@qq.com>
AuthorDate: Mon Apr 17 17:45:09 2023 +0800

    Support forkjoinpool plugin (#505)
---
 .github/workflows/plugins-test.3.yaml              |   1 +
 CHANGES.md                                         |   1 +
 .../jdk-forkjoinpool-plugin/pom.xml                |  79 ++++++++++++++
 .../ForkJoinTaskConstructorInterceptor.java        |  33 ++++++
 .../ForkJoinWorkerQueueMethodInterceptor.java      |  70 ++++++++++++
 .../define/ForkJoinTaskInstrumentation.java        |  67 ++++++++++++
 .../define/ForkJoinWorkerQueueInstrumentation.java |  74 +++++++++++++
 .../src/main/resources/skywalking-plugin.def       |  19 ++++
 apm-sniffer/bootstrap-plugins/pom.xml              |   1 +
 .../service-agent/java-agent/Bootstrap-plugins.md  |   1 +
 .../setup/service-agent/java-agent/Plugin-list.md  |   1 +
 .../service-agent/java-agent/Supported-list.md     |   1 +
 .../jdk-forkjoinpool-scenario/bin/startup.sh       |  21 ++++
 .../config/expectedData.yaml                       |  85 +++++++++++++++
 .../jdk-forkjoinpool-scenario/configuration.yml    |  23 ++++
 .../scenarios/jdk-forkjoinpool-scenario/pom.xml    | 121 +++++++++++++++++++++
 .../src/main/assembly/assembly.xml                 |  41 +++++++
 .../apm/testcase/jdk/forkjoinpool/Application.java |  34 ++++++
 .../forkjoinpool/controller/CaseController.java    |  61 +++++++++++
 .../src/main/resources/application.yaml            |  23 ++++
 .../src/main/resources/log4j2.xml                  |  30 +++++
 .../jdk-forkjoinpool-scenario/support-version.list |  17 +++
 22 files changed, 804 insertions(+)

diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml
index 3127472d31..cfdac7493d 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -101,6 +101,7 @@ jobs:
           - 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
diff --git a/CHANGES.md b/CHANGES.md
index f910d6321e..e80083e714 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Release Notes.
 ------------------
 
 * Exclude `synthetic` methods for the WitnessMethod mechanism
+* Support ForkJoinPool trace
 
 #### Documentation
 
diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/pom.xml b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/pom.xml
new file mode 100644
index 0000000000..f8aa899746
--- /dev/null
+++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/pom.xml
@@ -0,0 +1,79 @@
+<!--
+  ~ 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>
+        <groupId>org.apache.skywalking</groupId>
+        <artifactId>bootstrap-plugins</artifactId>
+        <version>8.16.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>apm-jdk-forkjoinpool-plugin</artifactId>
+    <packaging>jar</packaging>
+
+    <name>apm-jdk-forkjoinpool-plugin</name>
+    <url>http://maven.apache.org</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-deploy-plugin</artifactId>
+            </plugin>
+            <!-- Ignore the error of javadoc build -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-javadocs</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <failOnError>false</failOnError>
+                </configuration>
+            </plugin>
+            <!-- Build a dummy(empty) javadoc to satisfy maven central requirements -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>empty-javadoc-jar</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>javadoc</classifier>
+                            <classesDirectory>${basedir}/javadoc</classesDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/ForkJoinTaskConstructorInterceptor.java b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/ForkJoinTaskConstructorInterceptor.java
new file mode 100644
index 0000000000..1874dd6df1
--- /dev/null
+++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/ForkJoinTaskConstructorInterceptor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.plugin.jdk.forkjoinpool;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
+
+public class ForkJoinTaskConstructorInterceptor implements InstanceConstructorInterceptor {
+
+    @Override
+    public void onConstruct(EnhancedInstance objInst, Object[] allArguments) throws Throwable {
+        if (ContextManager.isActive()) {
+            objInst.setSkyWalkingDynamicField(ContextManager.capture());
+        }
+    }
+}
diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/ForkJoinWorkerQueueMethodInterceptor.java b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/ForkJoinWorkerQueueMethodInterceptor.java
new file mode 100644
index 0000000000..8715066d8c
--- /dev/null
+++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/ForkJoinWorkerQueueMethodInterceptor.java
@@ -0,0 +1,70 @@
+/*
+ * 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.plugin.jdk.forkjoinpool;
+
+import java.lang.reflect.Method;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.InstanceMethodsAroundInterceptorV2;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.MethodInvocationContext;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+public class ForkJoinWorkerQueueMethodInterceptor implements InstanceMethodsAroundInterceptorV2 {
+
+    @Override
+    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
+            MethodInvocationContext context) throws Throwable {
+        AbstractSpan span = ContextManager.createLocalSpan(generateOperationName(objInst, method));
+        span.setComponent(ComponentsDefine.JDK_THREADING);
+        context.setContext(span);
+        EnhancedInstance forkJoinTask = (EnhancedInstance) allArguments[0];
+        if (forkJoinTask != null) {
+            final Object storedField = forkJoinTask.getSkyWalkingDynamicField();
+            if (storedField != null) {
+                final ContextSnapshot contextSnapshot = (ContextSnapshot) storedField;
+                ContextManager.continued(contextSnapshot);
+            }
+        }
+    }
+
+    @Override
+    public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
+            Object ret, MethodInvocationContext context) throws Throwable {
+        AbstractSpan span = (AbstractSpan) context.getContext();
+        if (span != null) {
+            ContextManager.stopSpan(span);
+        }
+        return ret;
+    }
+
+    @Override
+    public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
+            Class<?>[] argumentsTypes, Throwable t, MethodInvocationContext context) {
+        AbstractSpan span = (AbstractSpan) context.getContext();
+        if (span != null) {
+            span.log(t);
+        }
+    }
+
+    private String generateOperationName(final EnhancedInstance objInst, final Method method) {
+        return "ForkJoinPool/" + objInst.getClass().getName() + "/" + method.getName();
+    }
+}
diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinTaskInstrumentation.java b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinTaskInstrumentation.java
new file mode 100644
index 0000000000..1393140a02
--- /dev/null
+++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinTaskInstrumentation.java
@@ -0,0 +1,67 @@
+/*
+ * 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.plugin.jdk.forkjoinpool.define;
+
+import static net.bytebuddy.matcher.ElementMatchers.any;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+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.HierarchyMatch;
+
+public class ForkJoinTaskInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+    private static final String FORK_JOIN_TASK_CLASS = "java.util.concurrent.ForkJoinTask";
+    private static final String FORK_JOIN_TASK_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jdk.forkjoinpool.ForkJoinTaskConstructorInterceptor";
+
+    @Override
+    protected ClassMatch enhanceClass() {
+        return HierarchyMatch.byHierarchyMatch(FORK_JOIN_TASK_CLASS);
+    }
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[]{
+                new ConstructorInterceptPoint() {
+                    @Override
+                    public ElementMatcher<MethodDescription> getConstructorMatcher() {
+                        return any();
+                    }
+
+                    @Override
+                    public String getConstructorInterceptor() {
+                        return FORK_JOIN_TASK_INTERCEPTOR;
+                    }
+                }
+        };
+    }
+
+    @Override
+    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+        return new InstanceMethodsInterceptPoint[0];
+    }
+
+    @Override
+    public boolean isBootstrapInstrumentation() {
+        return true;
+    }
+}
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
new file mode 100644
index 0000000000..9477b4b6fb
--- /dev/null
+++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/forkjoinpool/define/ForkJoinWorkerQueueInstrumentation.java
@@ -0,0 +1,74 @@
+/*
+ * 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.plugin.jdk.forkjoinpool.define;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.ClassInstanceMethodsEnhancePluginDefineV2;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.v2.InstanceMethodsInterceptV2Point;
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
+
+public class ForkJoinWorkerQueueInstrumentation extends ClassInstanceMethodsEnhancePluginDefineV2 {
+
+    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_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jdk.forkjoinpool.ForkJoinWorkerQueueMethodInterceptor";
+
+    @Override
+    protected ClassMatch enhanceClass() {
+        return NameMatch.byName(FORK_JOIN_WORKER_QUEUE_CLASS);
+    }
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[0];
+    }
+
+    @Override
+    public InstanceMethodsInterceptV2Point[] getInstanceMethodsInterceptV2Points() {
+        return new InstanceMethodsInterceptV2Point[]{
+                new InstanceMethodsInterceptV2Point() {
+                    @Override
+                    public ElementMatcher<MethodDescription> getMethodsMatcher() {
+                        return named(FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD);
+                    }
+
+                    @Override
+                    public String getMethodsInterceptorV2() {
+                        return FORK_JOIN_WORKER_QUEUE_RUN_TASK_METHOD_INTERCEPTOR;
+                    }
+
+                    @Override
+                    public boolean isOverrideArgs() {
+                        return false;
+                    }
+                }
+        };
+    }
+
+    @Override
+    public boolean isBootstrapInstrumentation() {
+        return true;
+    }
+}
diff --git a/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 0000000000..a5409d8879
--- /dev/null
+++ b/apm-sniffer/bootstrap-plugins/jdk-forkjoinpool-plugin/src/main/resources/skywalking-plugin.def
@@ -0,0 +1,19 @@
+# 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.
+
+jdk-forkjoinpool-plugin=org.apache.skywalking.apm.plugin.jdk.forkjoinpool.define.ForkJoinTaskInstrumentation
+jdk-forkjoinpool-plugin=org.apache.skywalking.apm.plugin.jdk.forkjoinpool.define.ForkJoinWorkerQueueInstrumentation
+
diff --git a/apm-sniffer/bootstrap-plugins/pom.xml b/apm-sniffer/bootstrap-plugins/pom.xml
index 2234d44e28..8a941be2d4 100644
--- a/apm-sniffer/bootstrap-plugins/pom.xml
+++ b/apm-sniffer/bootstrap-plugins/pom.xml
@@ -45,6 +45,7 @@
         <module>jdk-http-plugin</module>
         <module>jdk-threading-plugin</module>
         <module>jdk-threadpool-plugin</module>
+        <module>jdk-forkjoinpool-plugin</module>
     </modules>
 
     <dependencies>
diff --git a/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md b/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md
index c902144822..10dd955a9c 100644
--- a/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md
+++ b/docs/en/setup/service-agent/java-agent/Bootstrap-plugins.md
@@ -6,6 +6,7 @@ Now, we have the following known bootstrap plugins.
 * Plugin of JDK HttpURLConnection. Agent is compatible with JDK 1.8+
 * Plugin of JDK Callable and Runnable. Agent is compatible with JDK 1.8+
 * Plugin of JDK ThreadPoolExecutor. Agent is compatible with JDK 1.8+
+* Plugin of JDK ForkJoinPool. Agent is compatible with JDK 1.8+
 
 ### HttpURLConnection Plugin Notice
 The plugin of JDK HttpURLConnection depended on `sun.net.*`. When using Java 9+, You should add some JVM options as follows:
diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md
index f19b227e8b..02be2af88d 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -157,3 +157,4 @@
 - micronaut-http-server-3.2.x-3.6.x
 - nats-client-2.14.x-2.15.x
 - impala-jdbc-2.6.x
+- jdk-forkjoinpool-plugin
diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md
index 1bc0ada50a..df70f88033 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -127,6 +127,7 @@ metrics based on the tracing data.
   * [Spring @Async](https://github.com/spring-projects/spring-framework) 4.x and 5.x
   * [Quasar](https://github.com/puniverse/quasar) 0.7.x
   * JRE Callable and Runnable (Optional²)
+  * JRE ForkJoinPool (Optional²)
 * Cache
   * [Ehcache](https://www.ehcache.org/) 2.x
   * [GuavaCache](https://github.com/google/guava) 18.x -> 23.x (Optional²)
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/bin/startup.sh b/test/plugin/scenarios/jdk-forkjoinpool-scenario/bin/startup.sh
new file mode 100644
index 0000000000..99328dd16e
--- /dev/null
+++ b/test/plugin/scenarios/jdk-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/jdk-forkjoinpool-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-forkjoinpool-scenario/config/expectedData.yaml
new file mode 100644
index 0000000000..aabc63daa1
--- /dev/null
+++ b/test/plugin/scenarios/jdk-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: jdk-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/runTask'
+      parentSpanId: -1
+      spanId: 0
+      spanLayer: Unknown
+      startTime: nq 0
+      endTime: nq 0
+      componentId: 80
+      isError: false
+      spanType: Local
+      peer: ''
+      refs:
+      - {parentEndpoint: 'GET:/jdk-forkjoinpool-scenario/case/jdk-forkjoinpool-scenario', networkAddress: '', refType: CrossThread,
+        parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not
+          null, parentService: jdk-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:/jdk-forkjoinpool-scenario/case/jdk-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/jdk-forkjoinpool-scenario/case/jdk-forkjoinpool-scenario'}
+      - {key: http.method, value: GET}
+      - {key: http.status_code, value: '200'}
+      peer: ''
+      skipAnalysis: 'false'
+
+
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/configuration.yml b/test/plugin/scenarios/jdk-forkjoinpool-scenario/configuration.yml
new file mode 100644
index 0000000000..f4edeed221
--- /dev/null
+++ b/test/plugin/scenarios/jdk-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/jdk-forkjoinpool-scenario/case/jdk-forkjoinpool-scenario
+healthCheck: http://localhost:8080/jdk-forkjoinpool-scenario/case/healthCheck
+runningMode: with_bootstrap
+withPlugins: apm-jdk-forkjoinpool-plugin-*.jar
+startScript: ./bin/startup.sh
+
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/pom.xml b/test/plugin/scenarios/jdk-forkjoinpool-scenario/pom.xml
new file mode 100644
index 0000000000..27d86a9e29
--- /dev/null
+++ b/test/plugin/scenarios/jdk-forkjoinpool-scenario/pom.xml
@@ -0,0 +1,121 @@
+<?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">
+
+    <groupId>org.apache.skywalking.apm.testcase</groupId>
+    <artifactId>jdk-forkjoinpool-scenario</artifactId>
+    <version>1.0.0</version>
+    <packaging>jar</packaging>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <compiler.version>1.8</compiler.version>
+        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
+        <test.framework.version>YOUR VERSION</test.framework.version>
+        <spring.boot.version>2.1.6.RELEASE</spring.boot.version>
+        <lombok.version>1.18.20</lombok.version>
+    </properties>
+
+    <name>skywalking-jdk-forkjoinpool-scenario</name>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring.boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-log4j2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>${lombok.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>jdk-forkjoinpool-scenario</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring.boot.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>${maven-compiler-plugin.version}</version>
+                <configuration>
+                    <source>${compiler.version}</source>
+                    <target>${compiler.version}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>assemble</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/assembly.xml</descriptor>
+                            </descriptors>
+                            <outputDirectory>./target/</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000000..8a7cb151de
--- /dev/null
+++ b/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?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.
+  ~
+  -->
+<assembly
+    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <formats>
+        <format>zip</format>
+    </formats>
+
+    <fileSets>
+        <fileSet>
+            <directory>./bin</directory>
+            <fileMode>0775</fileMode>
+        </fileSet>
+    </fileSets>
+
+    <files>
+        <file>
+            <source>${project.build.directory}/jdk-forkjoinpool-scenario.jar</source>
+            <outputDirectory>./libs</outputDirectory>
+            <fileMode>0775</fileMode>
+        </file>
+    </files>
+</assembly>
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/Application.java b/test/plugin/scenarios/jdk-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/jdk-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/jdk-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/controller/CaseController.java b/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/java/org/apache/skywalking/apm/testcase/jdk/forkjoinpool/controller/CaseController.java
new file mode 100644
index 0000000000..4ace792a82
--- /dev/null
+++ b/test/plugin/scenarios/jdk-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("/jdk-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/jdk-forkjoinpool-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/resources/application.yaml
new file mode 100644
index 0000000000..e2cd1494bc
--- /dev/null
+++ b/test/plugin/scenarios/jdk-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: /jdk-forkjoinpool-scenario
+logging:
+  config: classpath:log4j2.xml
\ No newline at end of file
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..9849ed5a8a
--- /dev/null
+++ b/test/plugin/scenarios/jdk-forkjoinpool-scenario/src/main/resources/log4j2.xml
@@ -0,0 +1,30 @@
+<?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.
+  ~
+  -->
+<Configuration status="WARN">
+    <Appenders>
+        <Console name="Console" target="SYSTEM_ERR">
+            <PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="WARN">
+            <AppenderRef ref="Console"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/test/plugin/scenarios/jdk-forkjoinpool-scenario/support-version.list b/test/plugin/scenarios/jdk-forkjoinpool-scenario/support-version.list
new file mode 100644
index 0000000000..658e529523
--- /dev/null
+++ b/test/plugin/scenarios/jdk-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