From add2bbf208af8e00fdca0ef584117a1e48dd00fb Mon Sep 17 00:00:00 2001
From: xu1009 <2933250475@qq.com>
Date: Mon, 7 Feb 2022 08:08:43 +0800
Subject: [PATCH] Feature/support tomcat thread pool (#105)
---
.github/workflows/plugins-test.3.yaml | 1 +
CHANGES.md | 2 +-
apm-sniffer/apm-sdk-plugin/pom.xml | 1 +
.../tomcat-thread-pool-plugin/pom.xml | 35 +++++
.../pool/TomcatThreadExecutorInterceptor.java | 54 +++++++
.../TomcatThreadExecutorInstrumentation.java | 68 +++++++++
.../src/main/resources/skywalking-plugin.def | 17 +++
.../service-agent/java-agent/Plugin-list.md | 1 +
.../java-agent/Supported-list.md | 2 +-
.../config/expectedData.yaml | 32 ++++-
.../bin/startup.sh | 21 +++
.../config/expectedData.yaml | 49 +++++++
.../configuration.yml | 23 +++
.../tomcat-thread-pool-scenario/pom.xml | 134 ++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++
.../tomcat/thread/pool/Application.java | 34 +++++
.../pool/controller/CaseController.java | 47 ++++++
.../src/main/resources/application.yaml | 23 +++
.../src/main/resources/log4j2.xml | 30 ++++
.../support-version.list | 24 ++++
20 files changed, 636 insertions(+), 3 deletions(-)
create mode 100644 apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/pom.xml
create mode 100644 apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/TomcatThreadExecutorInterceptor.java
create mode 100644 apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/define/TomcatThreadExecutorInstrumentation.java
create mode 100644 apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/resources/skywalking-plugin.def
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/bin/startup.sh
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/config/expectedData.yaml
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/configuration.yml
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/pom.xml
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/assembly/assembly.xml
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/Application.java
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/controller/CaseController.java
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/resources/application.yaml
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/resources/log4j2.xml
create mode 100644 test/plugin/scenarios/tomcat-thread-pool-scenario/support-version.list
diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml
index 3e3070c33..ed003977c 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -93,6 +93,7 @@ jobs:
- clickhouse-0.3.x-scenario
- kylin-jdbc-2.6.x-3.x-4.x-scenario
- undertow-worker-thread-pool-scenario
+ - tomcat-thread-pool-scenario
steps:
- uses: actions/checkout@v2
with:
diff --git a/CHANGES.md b/CHANGES.md
index c52fd8564..570b63d9c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -5,7 +5,7 @@ Release Notes.
8.10.0
------------------
* Support Undertow thread pool metrics collecting.
-
+* Support Tomcat thread pool metric collect.
#### Documentation
diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml
index f0ba0080e..0bbb4c6d2 100644
--- a/apm-sniffer/apm-sdk-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/pom.xml
@@ -118,6 +118,7 @@
pulsar-commonpulsar-2.8.x-pluginundertow-worker-thread-pool-plugin
+ tomcat-thread-pool-pluginpom
diff --git a/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/pom.xml
new file mode 100644
index 000000000..9b5dcc746
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/pom.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+ apm-sdk-plugin
+ org.apache.skywalking
+ 8.10.0-SNAPSHOT
+
+ 4.0.0
+
+ apm-tomcat-thread-pool-plugin
+ tomcat-thread-pool-plugin
+ http://maven.apache.org
+
+
+
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/TomcatThreadExecutorInterceptor.java b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/TomcatThreadExecutorInterceptor.java
new file mode 100644
index 000000000..b97f219ba
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/TomcatThreadExecutorInterceptor.java
@@ -0,0 +1,54 @@
+/*
+ * 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.tomcat.thread.pool;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import org.apache.skywalking.apm.agent.core.meter.MeterFactory;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
+
+public class TomcatThreadExecutorInterceptor implements InstanceConstructorInterceptor {
+
+ private static final String THREAD_POOL_NAME = "tomcat_execute_pool";
+ private static final Map>> METRIC_MAP = new HashMap>>() {{
+ put("core_pool_size", (ThreadPoolExecutor threadPoolExecutor) -> () -> (double) threadPoolExecutor.getCorePoolSize());
+ put("max_pool_size", (ThreadPoolExecutor threadPoolExecutor) -> () -> (double) threadPoolExecutor.getMaximumPoolSize());
+ put("pool_size", (ThreadPoolExecutor threadPoolExecutor) -> () -> (double) threadPoolExecutor.getPoolSize());
+ put("queue_size", (ThreadPoolExecutor threadPoolExecutor) -> () -> (double) threadPoolExecutor.getQueue().size());
+ put("active_size", (ThreadPoolExecutor threadPoolExecutor) -> () -> (double) threadPoolExecutor.getActiveCount());
+ }};
+
+ @Override
+ public void onConstruct(EnhancedInstance objInst, Object[] allArguments) throws Throwable {
+ ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) objInst;
+ buildThreadPoolMeterMetric(threadPoolExecutor);
+ }
+
+ private void buildThreadPoolMeterMetric(ThreadPoolExecutor threadPoolExecutor) {
+ String threadPoolMeterName = "thread_pool";
+ String poolNameTag = "pool_name";
+ String metricTypeTag = "metric_type";
+ METRIC_MAP.forEach((key, value) -> MeterFactory.gauge(threadPoolMeterName, value.apply(threadPoolExecutor))
+ .tag(poolNameTag, THREAD_POOL_NAME).tag(metricTypeTag, key).build());
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/define/TomcatThreadExecutorInstrumentation.java b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/define/TomcatThreadExecutorInstrumentation.java
new file mode 100644
index 000000000..ab52202ba
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat/thread/pool/define/TomcatThreadExecutorInstrumentation.java
@@ -0,0 +1,68 @@
+/*
+ * 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.tomcat.thread.pool.define;
+
+import static net.bytebuddy.matcher.ElementMatchers.any;
+import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+
+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.StaticMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine;
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+
+public class TomcatThreadExecutorInstrumentation extends ClassEnhancePluginDefine {
+
+ private static final String STANDARD_THREAD_EXECUTOR_CLASS = "org.apache.tomcat.util.threads.ThreadPoolExecutor";
+
+ private static final String TOMCAT_THREAD_EXECUTOR_INTERCEPTOR = "org.apache.skywalking.apm.plugin.tomcat.thread.pool.TomcatThreadExecutorInterceptor";
+
+ @Override
+ protected ClassMatch enhanceClass() {
+ return byName(STANDARD_THREAD_EXECUTOR_CLASS);
+ }
+
+ @Override
+ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[]{ new ConstructorInterceptPoint() {
+ @Override
+ public ElementMatcher getConstructorMatcher() {
+ return any();
+ }
+
+ @Override
+ public String getConstructorInterceptor() {
+ return TOMCAT_THREAD_EXECUTOR_INTERCEPTOR;
+ }
+ }
+ };
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[0];
+ }
+
+ @Override
+ public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
+ return new StaticMethodsInterceptPoint[0];
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 000000000..0750e0094
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/tomcat-thread-pool-plugin/src/main/resources/skywalking-plugin.def
@@ -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.
+
+tomcat-thread-pool=org.apache.skywalking.apm.plugin.tomcat.thread.pool.define.TomcatThreadExecutorInstrumentation
\ No newline at end of file
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 c18eed1ca..1d0ad9b6a 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -131,3 +131,4 @@
- okhttp-2.x
- pulsar-2.8.x
- undertow-worker-thread-pool
+- tomcat-thread-pool
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 aafa5bb73..c20b06fac 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -141,7 +141,7 @@ The meter plugin provides the advanced metrics collections, which are not a part
* Thread Pool
* [Undertow](https://github.com/undertow-io/undertow) 2.1.x -> 2.6.x
-
+ * [Tomcat](https://github.com/apache/tomcat) 7.0.x -> 10.0.x
___
¹Due to license incompatibilities/restrictions these plugins are hosted and released in 3rd part repository,
go to [SkyAPM java plugin extension repository](https://github.com/SkyAPM/java-plugin-extensions) to get these.
diff --git a/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml b/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml
index 1b3b25064..436ddf17e 100644
--- a/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml
@@ -481,7 +481,7 @@ segmentItems:
skipAnalysis: 'true'
meterItems:
- serviceName: apm-toolkit-trace-scenario
- meterSize: 3
+ meterSize: 8
meters:
- meterId:
name: test_counter
@@ -502,3 +502,33 @@ meterItems:
- 1.0
- 5.0
- 10.0
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: core_pool_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 1
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: max_pool_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 1
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: pool_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 0
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: active_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 0
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: queue_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 0
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/bin/startup.sh b/test/plugin/scenarios/tomcat-thread-pool-scenario/bin/startup.sh
new file mode 100644
index 000000000..8281e524a
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-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/tomcat-thread-pool-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/config/expectedData.yaml b/test/plugin/scenarios/tomcat-thread-pool-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..6a4cd6833
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-scenario/config/expectedData.yaml
@@ -0,0 +1,49 @@
+# 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.
+meterItems:
+ - serviceName: tomcat-thread-pool-scenario
+ meterSize: 5
+ meters:
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: core_pool_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 1
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: max_pool_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 1
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: pool_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 0
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: active_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 0
+ - meterId:
+ name: thread_pool
+ tags:
+ - {name: metric_type, value: queue_size}
+ - {name: pool_name, value: tomcat_execute_pool}
+ singleValue: ge 0
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/configuration.yml b/test/plugin/scenarios/tomcat-thread-pool-scenario/configuration.yml
new file mode 100644
index 000000000..0e141cb64
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-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/tomcat-thread-pool-scenario/case/tomcat-thread-pool-scenario
+healthCheck: http://localhost:8080/tomcat-thread-pool-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+ - SW_METER_REPORT_INTERVAL=1
+dependencies:
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/pom.xml b/test/plugin/scenarios/tomcat-thread-pool-scenario/pom.xml
new file mode 100644
index 000000000..a23c45d9b
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-scenario/pom.xml
@@ -0,0 +1,134 @@
+
+
+
+
+ org.apache.skywalking.apm.testcase
+ tomcat-thread-pool-scenario
+ 1.0.0
+ jar
+
+ 4.0.0
+
+
+ UTF-8
+ 1.8
+ 8.5.75
+ 2.1.6.RELEASE
+ 1.18.20
+
+
+ skywalking-tomcat-thread-pool-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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tomcat-thread-pool-scenario
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring.boot.version}
+
+
+
+ repackage
+
+
+
+
+
+ maven-compiler-plugin
+
+ ${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/tomcat-thread-pool-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..5de4ed1f1
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ${project.build.directory}/tomcat-thread-pool-scenario.jar
+ ./libs
+ 0775
+
+
+
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/Application.java b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/Application.java
new file mode 100644
index 000000000..138c92bee
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/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.tomcat.thread.pool;
+
+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/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/controller/CaseController.java b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/controller/CaseController.java
new file mode 100644
index 000000000..637e63d95
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/java/org/apache/skywalking/apm/testcase/tomcat/thread/pool/controller/CaseController.java
@@ -0,0 +1,47 @@
+/*
+ * 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.tomcat.thread.pool.controller;
+
+import lombok.extern.log4j.Log4j2;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/case")
+@Log4j2
+public class CaseController {
+
+ private static final String SUCCESS = "Success";
+
+ @RequestMapping("/tomcat-thread-pool-scenario")
+ @ResponseBody
+ public String testcase() {
+ // your codes
+ return SUCCESS;
+ }
+
+ @RequestMapping("/healthCheck")
+ @ResponseBody
+ public String healthCheck() {
+ // your codes
+ return SUCCESS;
+ }
+
+}
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/resources/application.yaml
new file mode 100644
index 000000000..bfeebe338
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-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: /tomcat-thread-pool-scenario
+logging:
+ config: classpath:log4j2.xml
\ No newline at end of file
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..9849ed5a8
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-scenario/src/main/resources/log4j2.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/tomcat-thread-pool-scenario/support-version.list b/test/plugin/scenarios/tomcat-thread-pool-scenario/support-version.list
new file mode 100644
index 000000000..6036bb75d
--- /dev/null
+++ b/test/plugin/scenarios/tomcat-thread-pool-scenario/support-version.list
@@ -0,0 +1,24 @@
+# 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.
+
+# lists your version here (Contains only the last version number of each minor version.)
+
+7.0.109
+8.0.53
+8.5.75
+9.0.58
+10.0.16
+