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 af4ddc61c9 Support jetty 11 (#545)
af4ddc61c9 is described below
commit af4ddc61c9893717bf4fad1f3c19bdff56b293b0
Author: xu1009 <[email protected]>
AuthorDate: Tue Jun 6 09:39:34 2023 +0800
Support jetty 11 (#545)
---
.github/workflows/plugins-jdk17-test.0.yaml | 2 +
CHANGES.md | 1 +
.../{ => jetty-client-11.x-plugin}/pom.xml | 29 ++---
.../v11/client/SyncHttpRequestSendInterceptor.java | 81 +++++++++++++
.../client/define/HttpRequestInstrumentation.java | 43 +++----
.../src/main/resources/skywalking-plugin.def | 17 +++
.../client/define/HttpRequestInstrumentation.java | 12 ++
.../{ => jetty-server-11.x-plugin}/pom.xml | 29 ++---
.../apm/plugin/jetty/v11/server/Constants.java | 24 ++++
.../jetty/v11/server/ForwardInterceptor.java | 63 ++++++++++
.../plugin/jetty/v11/server/HandleInterceptor.java | 80 +++++++++++++
.../define/AbstractWitnessInstrumentation.java | 39 +++++++
.../server/define/DispatcherInstrumentation.java | 7 +-
.../v11}/server/define/JettyInstrumentation.java | 36 +++---
.../src/main/resources/skywalking-plugin.def | 18 +++
.../define/AbstractWitnessInstrumentation.java | 39 +++++++
.../server/define/DispatcherInstrumentation.java | 51 ++++-----
.../v9/server/define/JettyInstrumentation.java | 31 +++--
apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml | 2 +
.../setup/service-agent/java-agent/Plugin-list.md | 2 +
.../service-agent/java-agent/Supported-list.md | 4 +-
.../scenarios/jetty-10.x-scenario/bin/startup.sh | 21 ++++
.../jetty-10.x-scenario/config/expectedData.yaml | 85 ++++++++++++++
.../jetty-10.x-scenario/configuration.yml | 22 ++++
test/plugin/scenarios/jetty-10.x-scenario/pom.xml | 127 +++++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 +++++++
.../apm/testcase/jetty10xserver/Application.java | 42 +++++++
.../jetty10xserver/controller/CaseController.java | 46 ++++++++
.../controller/ContextReceiveController.java | 34 ++++++
.../controller/HealCheckController.java | 34 ++++++
.../src/main/resources/log4j2.xml | 30 +++++
.../jetty-10.x-scenario/support-version.list | 20 ++++
.../scenarios/jetty-11.x-scenario/bin/startup.sh | 21 ++++
.../jetty-11.x-scenario/config/expectedData.yaml | 86 ++++++++++++++
.../jetty-11.x-scenario/configuration.yml | 22 ++++
test/plugin/scenarios/jetty-11.x-scenario/pom.xml | 127 +++++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 +++++++
.../apm/testcase/jetty11xserver/Application.java | 42 +++++++
.../jetty11xserver/controller/CaseController.java | 46 ++++++++
.../controller/ContextReceiveController.java | 35 ++++++
.../controller/HealCheckController.java | 35 ++++++
.../src/main/resources/log4j2.xml | 30 +++++
.../jetty-11.x-scenario/support-version.list | 19 +++
43 files changed, 1498 insertions(+), 118 deletions(-)
diff --git a/.github/workflows/plugins-jdk17-test.0.yaml
b/.github/workflows/plugins-jdk17-test.0.yaml
index 556214b9db..88ec2e1750 100644
--- a/.github/workflows/plugins-jdk17-test.0.yaml
+++ b/.github/workflows/plugins-jdk17-test.0.yaml
@@ -62,6 +62,8 @@ jobs:
- jetty-11.x-thread-pool-scenario
- grizzly-2.3.x-4.x-scenario
- grizzly-2.3.x-4.x-workthreadpool-scenario
+ - jetty-11.x-scenario
+ - jetty-10.x-scenario
steps:
- uses: actions/checkout@v2
with:
diff --git a/CHANGES.md b/CHANGES.md
index a641b1cb68..95d404c07e 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Release Notes.
------------------
* Support Jdk17 ZGC metric collect
+* Support Jetty 11.x plugin
#### Documentation
diff --git a/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/pom.xml
similarity index 71%
copy from apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
copy to apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/pom.xml
index 1b7bc0de2e..f8cecfea1a 100644
--- a/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/pom.xml
@@ -1,4 +1,3 @@
-<?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
@@ -18,27 +17,29 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
-
<parent>
+ <artifactId>jetty-plugins</artifactId>
<groupId>org.apache.skywalking</groupId>
- <artifactId>apm-sdk-plugin</artifactId>
<version>8.17.0-SNAPSHOT</version>
</parent>
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>jetty-plugins</artifactId>
- <modules>
- <module>jetty-client-9.x-plugin</module>
- <module>jetty-server-9.x-plugin</module>
- <module>jetty-client-9.0-plugin</module>
- </modules>
- <packaging>pom</packaging>
+ <artifactId>apm-jetty-client-11.x-plugin</artifactId>
+ <packaging>jar</packaging>
- <name>jetty-plugin</name>
+ <name>jetty-client-11.x-plugin</name>
<url>http://maven.apache.org</url>
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sdk.plugin.related.dir>/..</sdk.plugin.related.dir>
+ <jetty-client.version>11.0.15</jetty-client.version>
</properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-client</artifactId>
+ <version>${jetty-client.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/client/SyncHttpRequestSendInterceptor.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/client/SyncHttpRequestSendInterceptor.java
new file mode 100644
index 0000000000..06ca5057ba
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/client/SyncHttpRequestSendInterceptor.java
@@ -0,0 +1,81 @@
+/*
+ * 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.jetty.v11.client;
+
+import org.apache.skywalking.apm.agent.core.context.CarrierItem;
+import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.tag.Tags;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+import org.eclipse.jetty.client.HttpRequest;
+import org.eclipse.jetty.http.HttpField;
+
+import java.lang.reflect.Method;
+
+public class SyncHttpRequestSendInterceptor implements
InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[]
allArguments, Class<?>[] argumentsTypes,
+ MethodInterceptResult result) throws Throwable {
+ HttpRequest request = (HttpRequest) objInst;
+ ContextCarrier contextCarrier = new ContextCarrier();
+ AbstractSpan span = ContextManager.createExitSpan(request.getURI()
+ .getPath(), contextCarrier, request.getHost() + ":" + request
+ .getPort());
+ span.setComponent(ComponentsDefine.JETTY_CLIENT);
+
+ Tags.HTTP.METHOD.set(span, getHttpMethod(request));
+ Tags.URL.set(span, request.getURI().toString());
+ SpanLayer.asHttp(span);
+
+ CarrierItem next = contextCarrier.items();
+ while (next.hasNext()) {
+ next = next.next();
+ request.addHeader(new HttpField(next.getHeadKey(),
next.getHeadValue()));
+ }
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method,
Object[] allArguments, Class<?>[] argumentsTypes,
+ Object ret) throws Throwable {
+ ContextManager.stopSpan();
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method,
Object[] allArguments,
+ Class<?>[] argumentsTypes, Throwable t) {
+ ContextManager.activeSpan().log(t);
+ }
+
+ public String getHttpMethod(HttpRequest request) {
+ String method = request.getMethod();
+
+ if (method == null || method.length() == 0) {
+ method = "GET";
+ }
+
+ return method;
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/client/define/HttpRequestInstrumentation.java
similarity index 62%
copy from
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
copy to
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/client/define/HttpRequestInstrumentation.java
index cb20e10828..4b9f4b7746 100644
---
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/client/define/HttpRequestInstrumentation.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.plugin.jetty.v9.client.define;
+package org.apache.skywalking.apm.plugin.jetty.v11.client.define;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
@@ -29,17 +29,12 @@ import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
-/**
- * {@link HttpRequestInstrumentation} enhance the <code>send</code> method
without argument in
- * <code>org.eclipse.jetty.client.HttpRequest</code> by
<code>org.apache.skywalking.apm.plugin.jetty.client.SyncHttpRequestSendInterceptor</code>
- * and enhance the <code>send</code> with
<code>org.eclipse.jetty.client.api.Response$CompleteListener</code> parameter
- * by
<code>org.apache.skywalking.apm.plugin.jetty.client.AsyncHttpRequestSendInterceptor</code>
- */
public class HttpRequestInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS =
"org.eclipse.jetty.client.HttpRequest";
private static final String ENHANCE_CLASS_NAME = "send";
- public static final String SYNC_SEND_INTERCEPTOR =
"org.apache.skywalking.apm.plugin.jetty.v9.client.SyncHttpRequestSendInterceptor";
+ public static final String SYNC_SEND_INTERCEPTOR =
"org.apache.skywalking.apm.plugin.jetty.v11.client" +
+ ".SyncHttpRequestSendInterceptor";
@Override
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
@@ -48,24 +43,24 @@ public class HttpRequestInstrumentation extends
ClassInstanceMethodsEnhancePlugi
@Override
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints()
{
- return new InstanceMethodsInterceptPoint[] {
- new InstanceMethodsInterceptPoint() {
- //sync call interceptor point
- @Override
- public ElementMatcher<MethodDescription> getMethodsMatcher() {
- return named(ENHANCE_CLASS_NAME).and(takesArguments(0));
- }
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ //sync call interceptor point
+ @Override
+ public ElementMatcher<MethodDescription>
getMethodsMatcher() {
+ return
named(ENHANCE_CLASS_NAME).and(takesArguments(0));
+ }
- @Override
- public String getMethodsInterceptor() {
- return SYNC_SEND_INTERCEPTOR;
- }
+ @Override
+ public String getMethodsInterceptor() {
+ return SYNC_SEND_INTERCEPTOR;
+ }
- @Override
- public boolean isOverrideArgs() {
- return false;
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
}
- }
};
}
@@ -76,6 +71,6 @@ public class HttpRequestInstrumentation extends
ClassInstanceMethodsEnhancePlugi
@Override
protected String[] witnessClasses() {
- return new String[]
{"org.eclipse.jetty.client.AbstractHttpClientTransport"};
+ return new String[]{"org.eclipse.jetty.client.jmx.HttpClientMBean"};
}
}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/resources/skywalking-plugin.def
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 0000000000..3311ec791d
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-11.x-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.
+
+jetty-client-11.x=org.apache.skywalking.apm.plugin.jetty.v11.client.define.HttpRequestInstrumentation
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
index cb20e10828..d0456c11d0 100644
---
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
@@ -20,12 +20,16 @@ package
org.apache.skywalking.apm.plugin.jetty.v9.client.define;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
+import java.util.Collections;
+import java.util.List;
+
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
@@ -78,4 +82,12 @@ public class HttpRequestInstrumentation extends
ClassInstanceMethodsEnhancePlugi
protected String[] witnessClasses() {
return new String[]
{"org.eclipse.jetty.client.AbstractHttpClientTransport"};
}
+
+ @Override
+ protected List<WitnessMethod> witnessMethods() {
+ return Collections.singletonList(new WitnessMethod(
+ "org.eclipse.jetty.http.HttpFields",
+ named("getQuality")
+ ));
+ }
}
diff --git a/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/pom.xml
similarity index 71%
copy from apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
copy to apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/pom.xml
index 1b7bc0de2e..c73df2d53f 100644
--- a/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/pom.xml
@@ -1,4 +1,3 @@
-<?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
@@ -18,27 +17,29 @@
-->
<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">
- <modelVersion>4.0.0</modelVersion>
-
<parent>
+ <artifactId>jetty-plugins</artifactId>
<groupId>org.apache.skywalking</groupId>
- <artifactId>apm-sdk-plugin</artifactId>
<version>8.17.0-SNAPSHOT</version>
</parent>
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>jetty-plugins</artifactId>
- <modules>
- <module>jetty-client-9.x-plugin</module>
- <module>jetty-server-9.x-plugin</module>
- <module>jetty-client-9.0-plugin</module>
- </modules>
- <packaging>pom</packaging>
+ <artifactId>apm-jetty-server-11.x-plugin</artifactId>
+ <packaging>jar</packaging>
- <name>jetty-plugin</name>
+ <name>jetty-server-11.x-plugin</name>
<url>http://maven.apache.org</url>
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sdk.plugin.related.dir>/..</sdk.plugin.related.dir>
+ <jetty-server.version>11.0.15</jetty-server.version>
</properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>${jetty-server.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/Constants.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/Constants.java
new file mode 100644
index 0000000000..156bb0517b
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/Constants.java
@@ -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.
+ *
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jetty.v11.server;
+
+public class Constants {
+ public static final String FORWARD_REQUEST_FLAG =
"SW_FORWARD_REQUEST_FLAG";
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/ForwardInterceptor.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/ForwardInterceptor.java
new file mode 100644
index 0000000000..f98e15c8af
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/ForwardInterceptor.java
@@ -0,0 +1,63 @@
+/*
+ * 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.jetty.v11.server;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+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.InstanceConstructorInterceptor;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ForwardInterceptor implements InstanceMethodsAroundInterceptor,
InstanceConstructorInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[]
allArguments, Class<?>[] argumentsTypes,
+ MethodInterceptResult result) throws Throwable {
+ if (ContextManager.isActive()) {
+ AbstractSpan abstractTracingSpan = ContextManager.activeSpan();
+ Map<String, String> eventMap = new HashMap<String, String>();
+ eventMap.put("forward-url", (String)
objInst.getSkyWalkingDynamicField());
+ abstractTracingSpan.log(System.currentTimeMillis(), eventMap);
+
ContextManager.getRuntimeContext().put(Constants.FORWARD_REQUEST_FLAG, true);
+ }
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method,
Object[] allArguments, Class<?>[] argumentsTypes,
+ Object ret) throws Throwable {
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method,
Object[] allArguments,
+ Class<?>[] argumentsTypes, Throwable t) {
+
+ }
+
+ @Override
+ public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
+ objInst.setSkyWalkingDynamicField(allArguments[2]);
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/HandleInterceptor.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/HandleInterceptor.java
new file mode 100644
index 0000000000..a8f663a917
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/HandleInterceptor.java
@@ -0,0 +1,80 @@
+/*
+ * 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.jetty.v11.server;
+
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.apache.skywalking.apm.agent.core.context.CarrierItem;
+import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.tag.Tags;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+import org.eclipse.jetty.server.HttpChannel;
+
+import java.lang.reflect.Method;
+
+public class HandleInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[]
allArguments, Class<?>[] argumentsTypes,
+ MethodInterceptResult result) throws Throwable {
+ HttpChannel httpChannel = (HttpChannel) objInst;
+ HttpServletRequest servletRequest = httpChannel.getRequest();
+
+ ContextCarrier contextCarrier = new ContextCarrier();
+
+ CarrierItem next = contextCarrier.items();
+ while (next.hasNext()) {
+ next = next.next();
+ next.setHeadValue(servletRequest.getHeader(next.getHeadKey()));
+ }
+
+ AbstractSpan span =
ContextManager.createEntrySpan(servletRequest.getRequestURI(), contextCarrier);
+ Tags.URL.set(span, servletRequest.getRequestURL().toString());
+ Tags.HTTP.METHOD.set(span, servletRequest.getMethod());
+ span.setComponent(ComponentsDefine.JETTY_SERVER);
+ SpanLayer.asHttp(span);
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method,
Object[] allArguments, Class<?>[] argumentsTypes,
+ Object ret) throws Throwable {
+ HttpChannel httpChannel = (HttpChannel) objInst;
+ HttpServletResponse servletResponse = httpChannel.getResponse();
+ AbstractSpan span = ContextManager.activeSpan();
+ Tags.HTTP_RESPONSE_STATUS_CODE.set(span, servletResponse.getStatus());
+ if (servletResponse.getStatus() >= 400) {
+ span.errorOccurred();
+ }
+ ContextManager.stopSpan();
+
ContextManager.getRuntimeContext().remove(Constants.FORWARD_REQUEST_FLAG);
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method,
Object[] allArguments,
+ Class<?>[] argumentsTypes, Throwable t) {
+ ContextManager.activeSpan().log(t);
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/AbstractWitnessInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/AbstractWitnessInstrumentation.java
new file mode 100644
index 0000000000..ae0eef39f3
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/AbstractWitnessInstrumentation.java
@@ -0,0 +1,39 @@
+/*
+ * 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.jetty.v11.server.define;
+
+import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.Collections;
+import java.util.List;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
+
+public abstract class AbstractWitnessInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+ @Override
+ protected List<WitnessMethod> witnessMethods() {
+ return Collections.singletonList(new WitnessMethod(
+ "org.eclipse.jetty.server.Handler",
+ named("handle").and(takesArgument(2,
named("jakarta.servlet.http.HttpServletRequest")))
+ ));
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/DispatcherInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/DispatcherInstrumentation.java
similarity index 90%
copy from
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/DispatcherInstrumentation.java
copy to
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/DispatcherInstrumentation.java
index 309d7eff12..d843ae629f 100644
---
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/DispatcherInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/DispatcherInstrumentation.java
@@ -17,23 +17,22 @@
*
*/
-package org.apache.skywalking.apm.plugin.jetty.v9.server.define;
+package org.apache.skywalking.apm.plugin.jetty.v11.server.define;
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 static net.bytebuddy.matcher.ElementMatchers.named;
import static
org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
import static
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
-public class DispatcherInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class DispatcherInstrumentation extends AbstractWitnessInstrumentation {
private static final String ENHANCE_CLASS =
"org.eclipse.jetty.server.Dispatcher";
- public static final String INTERCEPT_CLASS =
"org.apache.skywalking.apm.plugin.jetty.v9.server.ForwardInterceptor";
+ public static final String INTERCEPT_CLASS =
"org.apache.skywalking.apm.plugin.jetty.v11.server.ForwardInterceptor";
@Override
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/JettyInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/JettyInstrumentation.java
similarity index 70%
copy from
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/JettyInstrumentation.java
copy to
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/JettyInstrumentation.java
index 439128a89c..417dc67df3 100644
---
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/JettyInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v11/server/define/JettyInstrumentation.java
@@ -16,13 +16,12 @@
*
*/
-package org.apache.skywalking.apm.plugin.jetty.v9.server.define;
+package org.apache.skywalking.apm.plugin.jetty.v11.server.define;
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.NameMatch;
@@ -32,11 +31,12 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
* {@link JettyInstrumentation} enhance the <code>handle</code> method in
<code>org.eclipse.jetty.server.handler.HandlerList</code>
* by <code>HandleInterceptor</code>
*/
-public class JettyInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class JettyInstrumentation extends AbstractWitnessInstrumentation {
private static final String ENHANCE_CLASS =
"org.eclipse.jetty.server.HttpChannel";
private static final String ENHANCE_METHOD = "handle";
- private static final String INTERCEPTOR_CLASS =
"org.apache.skywalking.apm.plugin.jetty.v9.server.HandleInterceptor";
+ private static final String INTERCEPTOR_CLASS =
"org.apache.skywalking.apm.plugin.jetty.v11.server" +
+ ".HandleInterceptor";
@Override
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
@@ -45,23 +45,23 @@ public class JettyInstrumentation extends
ClassInstanceMethodsEnhancePluginDefin
@Override
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints()
{
- return new InstanceMethodsInterceptPoint[] {
- new InstanceMethodsInterceptPoint() {
- @Override
- public ElementMatcher<MethodDescription> getMethodsMatcher() {
- return named(ENHANCE_METHOD);
- }
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription>
getMethodsMatcher() {
+ return named(ENHANCE_METHOD);
+ }
- @Override
- public String getMethodsInterceptor() {
- return INTERCEPTOR_CLASS;
- }
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
- @Override
- public boolean isOverrideArgs() {
- return false;
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
}
- }
};
}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/resources/skywalking-plugin.def
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 0000000000..a7828a8f4b
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-11.x-plugin/src/main/resources/skywalking-plugin.def
@@ -0,0 +1,18 @@
+# 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.
+
+jetty-server-11.x=org.apache.skywalking.apm.plugin.jetty.v11.server.define.JettyInstrumentation
+jetty-server-11.x=org.apache.skywalking.apm.plugin.jetty.v11.server.define.DispatcherInstrumentation
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/AbstractWitnessInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/AbstractWitnessInstrumentation.java
new file mode 100644
index 0000000000..9ed1aba497
--- /dev/null
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/AbstractWitnessInstrumentation.java
@@ -0,0 +1,39 @@
+/*
+ * 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.jetty.v9.server.define;
+
+import org.apache.skywalking.apm.agent.core.plugin.WitnessMethod;
+import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+
+import java.util.Collections;
+import java.util.List;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
+
+public abstract class AbstractWitnessInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+ @Override
+ protected List<WitnessMethod> witnessMethods() {
+ return Collections.singletonList(new WitnessMethod(
+ "org.eclipse.jetty.server.Handler",
+ named("handle").and(takesArgument(2,
named("javax.servlet.http.HttpServletRequest")))
+ ));
+ }
+}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/DispatcherInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/DispatcherInstrumentation.java
index 309d7eff12..343e7d28c8 100644
---
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/DispatcherInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/DispatcherInstrumentation.java
@@ -23,54 +23,53 @@ 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 static net.bytebuddy.matcher.ElementMatchers.named;
import static
org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
import static
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
-public class DispatcherInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class DispatcherInstrumentation extends AbstractWitnessInstrumentation {
private static final String ENHANCE_CLASS =
"org.eclipse.jetty.server.Dispatcher";
public static final String INTERCEPT_CLASS =
"org.apache.skywalking.apm.plugin.jetty.v9.server.ForwardInterceptor";
@Override
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
- return new ConstructorInterceptPoint[] {
- new ConstructorInterceptPoint() {
- @Override
- public ElementMatcher<MethodDescription>
getConstructorMatcher() {
- return takesArgumentWithType(2, "java.lang.String");
- }
+ return new ConstructorInterceptPoint[]{
+ new ConstructorInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription>
getConstructorMatcher() {
+ return takesArgumentWithType(2, "java.lang.String");
+ }
- @Override
- public String getConstructorInterceptor() {
- return INTERCEPT_CLASS;
+ @Override
+ public String getConstructorInterceptor() {
+ return INTERCEPT_CLASS;
+ }
}
- }
};
}
@Override
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints()
{
- return new InstanceMethodsInterceptPoint[] {
- new InstanceMethodsInterceptPoint() {
- @Override
- public ElementMatcher<MethodDescription> getMethodsMatcher() {
- return named("forward");
- }
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription>
getMethodsMatcher() {
+ return named("forward");
+ }
- @Override
- public String getMethodsInterceptor() {
- return INTERCEPT_CLASS;
- }
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPT_CLASS;
+ }
- @Override
- public boolean isOverrideArgs() {
- return false;
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
}
- }
};
}
diff --git
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/JettyInstrumentation.java
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/JettyInstrumentation.java
index 439128a89c..59ac7307e6 100644
---
a/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/JettyInstrumentation.java
+++
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-server-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/server/define/JettyInstrumentation.java
@@ -22,7 +22,6 @@ 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.NameMatch;
@@ -32,7 +31,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
* {@link JettyInstrumentation} enhance the <code>handle</code> method in
<code>org.eclipse.jetty.server.handler.HandlerList</code>
* by <code>HandleInterceptor</code>
*/
-public class JettyInstrumentation extends
ClassInstanceMethodsEnhancePluginDefine {
+public class JettyInstrumentation extends AbstractWitnessInstrumentation {
private static final String ENHANCE_CLASS =
"org.eclipse.jetty.server.HttpChannel";
private static final String ENHANCE_METHOD = "handle";
@@ -45,23 +44,23 @@ public class JettyInstrumentation extends
ClassInstanceMethodsEnhancePluginDefin
@Override
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints()
{
- return new InstanceMethodsInterceptPoint[] {
- new InstanceMethodsInterceptPoint() {
- @Override
- public ElementMatcher<MethodDescription> getMethodsMatcher() {
- return named(ENHANCE_METHOD);
- }
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription>
getMethodsMatcher() {
+ return named(ENHANCE_METHOD);
+ }
- @Override
- public String getMethodsInterceptor() {
- return INTERCEPTOR_CLASS;
- }
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
- @Override
- public boolean isOverrideArgs() {
- return false;
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
}
- }
};
}
diff --git a/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
b/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
index 1b7bc0de2e..1a86067746 100644
--- a/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
@@ -31,6 +31,8 @@
<module>jetty-client-9.x-plugin</module>
<module>jetty-server-9.x-plugin</module>
<module>jetty-client-9.0-plugin</module>
+ <module>jetty-server-11.x-plugin</module>
+ <module>jetty-client-11.x-plugin</module>
</modules>
<packaging>pom</packaging>
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 92beac632d..9043febbf7 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -163,3 +163,5 @@
- jersey-3.x
- grizzly-2.3.x-4.x
- grizzly-2.3.x-4.x-threadpool
+- jetty-server-11.x
+- jetty-client-11.x
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 d6e71f4a14..a6ed661e48 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -14,7 +14,7 @@ metrics based on the tracing data.
* [Struts2 MVC](http://struts.apache.org/) 2.3.x -> 2.5.x
* [Resin](https://www.caucho.com/resin-4.0/) 3 (Optional¹)
* [Resin](https://www.caucho.com/resin-4.0/) 4 (Optional¹)
- * [Jetty Server](http://www.eclipse.org/jetty/) 9
+ * [Jetty Server](http://www.eclipse.org/jetty/) 9.x -> 11.x
* [Spring
WebFlux](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html)
5.x (Optional¹)
* [Undertow](http://undertow.io/) 1.3.0.Final -> 2.0.27.Final
* [RESTEasy](https://resteasy.github.io/) 3.1.0.Final -> 4.7.6.Final
@@ -31,7 +31,7 @@ metrics based on the tracing data.
* [Apache httpcomponent HttpClient](http://hc.apache.org/) 2.0 -> 3.1, 4.2,
4.3, 5.0, 5.1
* [Spring RestTemplate](https://github.com/spring-projects/spring-framework)
4.x
* [Spring RestTemplate](https://github.com/spring-projects/spring-framework)
6.x (Optional²)
- * [Jetty Client](http://www.eclipse.org/jetty/) 9
+ * [Jetty Client](http://www.eclipse.org/jetty/) 9.x -> 11.x
* [Apache httpcomponent
AsyncClient](https://hc.apache.org/httpcomponents-asyncclient-4.1.x/) 4.x
* [AsyncHttpClient](https://github.com/AsyncHttpClient/async-http-client)
2.1+
* JRE HttpURLConnection (Optional²)
diff --git a/test/plugin/scenarios/jetty-10.x-scenario/bin/startup.sh
b/test/plugin/scenarios/jetty-10.x-scenario/bin/startup.sh
new file mode 100644
index 0000000000..485d21665b
--- /dev/null
+++ b/test/plugin/scenarios/jetty-10.x-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/jetty-10.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/jetty-10.x-scenario/config/expectedData.yaml
b/test/plugin/scenarios/jetty-10.x-scenario/config/expectedData.yaml
new file mode 100644
index 0000000000..74aeaf7c43
--- /dev/null
+++ b/test/plugin/scenarios/jetty-10.x-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: jetty-10.x-scenario
+ segmentSize: ge 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /jetty-10.x-scenario/case/receive-context
+ parentSpanId: '-1'
+ spanId: '0'
+ spanLayer: Http
+ tags:
+ - key: url
+ value:
http://127.0.0.1:18080/jetty-10.x-scenario/case/receive-context
+ - key: http.method
+ value: GET
+ - key: http.status_code
+ value: '200'
+ refs:
+ - parentEndpoint: /jetty-10.x-scenario/case/jetty-10.x-scenario
+ networkAddress: '127.0.0.1:18080'
+ refType: CrossProcess
+ parentSpanId: 1
+ parentTraceSegmentId: not null
+ parentServiceInstance: not null
+ parentService: jetty-10.x-scenario
+ traceId: not null
+ startTime: gt 0
+ endTime: gt 0
+ componentId: '19'
+ isError: 'false'
+ spanType: Entry
+ peer: ''
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /jetty-10.x-scenario/case/receive-context
+ parentSpanId: '0'
+ spanId: '1'
+ spanLayer: Http
+ tags:
+ - key: http.method
+ value: GET
+ - key: url
+ value:
'http://127.0.0.1:18080/jetty-10.x-scenario/case/receive-context'
+ startTime: gt 0
+ endTime: gt 0
+ componentId: '18'
+ isError: 'false'
+ spanType: Exit
+ peer: '127.0.0.1:18080'
+ skipAnalysis: 'false'
+ - operationName: /jetty-10.x-scenario/case/jetty-10.x-scenario
+ parentSpanId: '-1'
+ spanId: '0'
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: '19'
+ isError: 'false'
+ spanType: Entry
+ peer: ''
+ skipAnalysis: 'false'
+ tags:
+ - key: url
+ value:
http://localhost:18080/jetty-10.x-scenario/case/jetty-10.x-scenario
+ - key: http.method
+ value: GET
+ - key: http.status_code
+ value: '200'
+
diff --git a/test/plugin/scenarios/jetty-10.x-scenario/configuration.yml
b/test/plugin/scenarios/jetty-10.x-scenario/configuration.yml
new file mode 100644
index 0000000000..a7e61d09b7
--- /dev/null
+++ b/test/plugin/scenarios/jetty-10.x-scenario/configuration.yml
@@ -0,0 +1,22 @@
+# 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:18080/jetty-10.x-scenario/case/jetty-10.x-scenario
+healthCheck: http://localhost:18080/jetty-10.x-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+dependencies:
diff --git a/test/plugin/scenarios/jetty-10.x-scenario/pom.xml
b/test/plugin/scenarios/jetty-10.x-scenario/pom.xml
new file mode 100644
index 0000000000..19b6abf947
--- /dev/null
+++ b/test/plugin/scenarios/jetty-10.x-scenario/pom.xml
@@ -0,0 +1,127 @@
+<?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>jetty-10.x-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>10.0.15</test.framework.version>
+
+ <log4j.version>2.6.2</log4j.version>
+ </properties>
+
+ <name>skywalking-jetty-10.x-scenario</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-client</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <finalName>jetty-10.x-scenario</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <transformers>
+ <transformer
+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>
+
org.apache.skywalking.apm.testcase.jetty10xserver.Application
+ </mainClass>
+ </transformer>
+ </transformers>
+ </configuration>
+ </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/jetty-10.x-scenario/src/main/assembly/assembly.xml
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000000..0b97eb2dae
--- /dev/null
+++ b/test/plugin/scenarios/jetty-10.x-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}/jetty-10.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git
a/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/Application.java
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/Application.java
new file mode 100644
index 0000000000..dbcfff57d7
--- /dev/null
+++
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/Application.java
@@ -0,0 +1,42 @@
+/*
+ * 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.jetty10xserver;
+
+import
org.apache.skywalking.apm.testcase.jetty10xserver.controller.CaseController;
+import
org.apache.skywalking.apm.testcase.jetty10xserver.controller.ContextReceiveController;
+import
org.apache.skywalking.apm.testcase.jetty10xserver.controller.HealCheckController;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+
+import java.net.InetSocketAddress;
+
+public class Application {
+
+ public static void main(String[] args) throws Exception {
+ Server jettyServer = new Server(new InetSocketAddress("0.0.0.0",
18080));
+ String contextPath = "/jetty-10.x-scenario";
+ ServletContextHandler servletContextHandler = new
ServletContextHandler(ServletContextHandler.NO_SESSIONS);
+ servletContextHandler.setContextPath(contextPath);
+ servletContextHandler.addServlet(CaseController.class,
CaseController.SERVLET_PATH);
+ servletContextHandler.addServlet(ContextReceiveController.class,
ContextReceiveController.SERVLET_PATH);
+ servletContextHandler.addServlet(HealCheckController.class,
HealCheckController.SERVLET_PATH);
+ jettyServer.setHandler(servletContextHandler);
+ jettyServer.start();
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/CaseController.java
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/CaseController.java
new file mode 100644
index 0000000000..1442bc8845
--- /dev/null
+++
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/CaseController.java
@@ -0,0 +1,46 @@
+/*
+ * 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.jetty10xserver.controller;
+
+import org.eclipse.jetty.client.HttpClient;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class CaseController extends HttpServlet {
+
+ public static String SERVLET_PATH = "/case/jetty-10.x-scenario";
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
+ try {
+ HttpClient client = new HttpClient();
+ client.start();
+ String cc =
client.GET("http://127.0.0.1:18080/jetty-10.x-scenario/case/receive-context")
+ .getContentAsString();
+ resp.getWriter().println(cc);
+ } catch (InterruptedException ignored) {
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/ContextReceiveController.java
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/ContextReceiveController.java
new file mode 100644
index 0000000000..9425a8de10
--- /dev/null
+++
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/ContextReceiveController.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.jetty10xserver.controller;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class ContextReceiveController extends HttpServlet {
+ public static String SERVLET_PATH = "/case/receive-context";
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
+ resp.getWriter().println("hello");
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/HealCheckController.java
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/HealCheckController.java
new file mode 100644
index 0000000000..9a14b1adc6
--- /dev/null
+++
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty10xserver/controller/HealCheckController.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.jetty10xserver.controller;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class HealCheckController extends HttpServlet {
+ public static String SERVLET_PATH = "/case/healthCheck";
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
+ resp.getWriter().println("hello");
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-10.x-scenario/src/main/resources/log4j2.xml
b/test/plugin/scenarios/jetty-10.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..9849ed5a8a
--- /dev/null
+++ b/test/plugin/scenarios/jetty-10.x-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/jetty-10.x-scenario/support-version.list
b/test/plugin/scenarios/jetty-10.x-scenario/support-version.list
new file mode 100644
index 0000000000..90fcd58492
--- /dev/null
+++ b/test/plugin/scenarios/jetty-10.x-scenario/support-version.list
@@ -0,0 +1,20 @@
+# 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.
+
+10.0.0
+10.0.7
+10.0.15
+
diff --git a/test/plugin/scenarios/jetty-11.x-scenario/bin/startup.sh
b/test/plugin/scenarios/jetty-11.x-scenario/bin/startup.sh
new file mode 100644
index 0000000000..524e87667f
--- /dev/null
+++ b/test/plugin/scenarios/jetty-11.x-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/jetty-11.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/jetty-11.x-scenario/config/expectedData.yaml
b/test/plugin/scenarios/jetty-11.x-scenario/config/expectedData.yaml
new file mode 100644
index 0000000000..dd65ed929b
--- /dev/null
+++ b/test/plugin/scenarios/jetty-11.x-scenario/config/expectedData.yaml
@@ -0,0 +1,86 @@
+# 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: jetty-11.x-scenario
+ segmentSize: ge 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /jetty-11.x-scenario/case/receive-context
+ parentSpanId: '-1'
+ spanId: '0'
+ spanLayer: Http
+ tags:
+ - key: url
+ value:
http://127.0.0.1:18080/jetty-11.x-scenario/case/receive-context
+ - key: http.method
+ value: GET
+ - key: http.status_code
+ value: '200'
+ refs:
+ - parentEndpoint: /jetty-11.x-scenario/case/jetty-11.x-scenario
+ networkAddress: '127.0.0.1:18080'
+ refType: CrossProcess
+ parentSpanId: 1
+ parentTraceSegmentId: not null
+ parentServiceInstance: not null
+ parentService: jetty-11.x-scenario
+ traceId: not null
+ startTime: gt 0
+ endTime: gt 0
+ componentId: '19'
+ isError: 'false'
+ spanType: Entry
+ peer: ''
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /jetty-11.x-scenario/case/receive-context
+ parentSpanId: '0'
+ spanId: '1'
+ spanLayer: Http
+ tags:
+ - key: http.method
+ value: GET
+ - key: url
+ value:
'http://127.0.0.1:18080/jetty-11.x-scenario/case/receive-context'
+ startTime: gt 0
+ endTime: gt 0
+ componentId: '18'
+ isError: 'false'
+ spanType: Exit
+ peer: '127.0.0.1:18080'
+ skipAnalysis: 'false'
+ - operationName: /jetty-11.x-scenario/case/jetty-11.x-scenario
+ parentSpanId: '-1'
+ spanId: '0'
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: '19'
+ isError: 'false'
+ spanType: Entry
+ peer: ''
+ skipAnalysis: 'false'
+ tags:
+ - key: url
+ value:
http://localhost:18080/jetty-11.x-scenario/case/jetty-11.x-scenario
+ - key: http.method
+ value: GET
+ - key: http.status_code
+ value: '200'
+
+
diff --git a/test/plugin/scenarios/jetty-11.x-scenario/configuration.yml
b/test/plugin/scenarios/jetty-11.x-scenario/configuration.yml
new file mode 100644
index 0000000000..f1bc28fd0f
--- /dev/null
+++ b/test/plugin/scenarios/jetty-11.x-scenario/configuration.yml
@@ -0,0 +1,22 @@
+# 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:18080/jetty-11.x-scenario/case/jetty-11.x-scenario
+healthCheck: http://localhost:18080/jetty-11.x-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+dependencies:
diff --git a/test/plugin/scenarios/jetty-11.x-scenario/pom.xml
b/test/plugin/scenarios/jetty-11.x-scenario/pom.xml
new file mode 100644
index 0000000000..d53b0858ff
--- /dev/null
+++ b/test/plugin/scenarios/jetty-11.x-scenario/pom.xml
@@ -0,0 +1,127 @@
+<?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>jetty-11.x-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>11.0.15</test.framework.version>
+
+ <log4j.version>2.6.2</log4j.version>
+ </properties>
+
+ <name>skywalking-jetty-11.x-scenario</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-client</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <finalName>jetty-11.x-scenario</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <transformers>
+ <transformer
+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>
+
org.apache.skywalking.apm.testcase.jetty11xserver.Application
+ </mainClass>
+ </transformer>
+ </transformers>
+ </configuration>
+ </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/jetty-11.x-scenario/src/main/assembly/assembly.xml
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000000..fd43a98a06
--- /dev/null
+++ b/test/plugin/scenarios/jetty-11.x-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}/jetty-11.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git
a/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/Application.java
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/Application.java
new file mode 100644
index 0000000000..d705b55190
--- /dev/null
+++
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/Application.java
@@ -0,0 +1,42 @@
+/*
+ * 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.jetty11xserver;
+
+import
org.apache.skywalking.apm.testcase.jetty11xserver.controller.CaseController;
+import
org.apache.skywalking.apm.testcase.jetty11xserver.controller.ContextReceiveController;
+import
org.apache.skywalking.apm.testcase.jetty11xserver.controller.HealCheckController;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+
+import java.net.InetSocketAddress;
+
+public class Application {
+
+ public static void main(String[] args) throws Exception {
+ Server jettyServer = new Server(new InetSocketAddress("0.0.0.0",
18080));
+ String contextPath = "/jetty-11.x-scenario";
+ ServletContextHandler servletContextHandler = new
ServletContextHandler(ServletContextHandler.NO_SESSIONS);
+ servletContextHandler.setContextPath(contextPath);
+ servletContextHandler.addServlet(CaseController.class,
CaseController.SERVLET_PATH);
+ servletContextHandler.addServlet(ContextReceiveController.class,
ContextReceiveController.SERVLET_PATH);
+ servletContextHandler.addServlet(HealCheckController.class,
HealCheckController.SERVLET_PATH);
+ jettyServer.setHandler(servletContextHandler);
+ jettyServer.start();
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/CaseController.java
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/CaseController.java
new file mode 100644
index 0000000000..267c3bfa22
--- /dev/null
+++
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/CaseController.java
@@ -0,0 +1,46 @@
+/*
+ * 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.jetty11xserver.controller;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.eclipse.jetty.client.HttpClient;
+
+import java.io.IOException;
+
+public class CaseController extends HttpServlet {
+
+ public static String SERVLET_PATH = "/case/jetty-11.x-scenario";
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
+ try {
+ HttpClient client = new HttpClient();
+ client.start();
+ String cc =
client.GET("http://127.0.0.1:18080/jetty-11.x-scenario/case/receive-context")
+ .getContentAsString();
+ resp.getWriter().println(cc);
+ } catch (InterruptedException ignored) {
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/ContextReceiveController.java
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/ContextReceiveController.java
new file mode 100644
index 0000000000..06add37811
--- /dev/null
+++
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/ContextReceiveController.java
@@ -0,0 +1,35 @@
+/*
+ * 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.jetty11xserver.controller;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.io.IOException;
+
+public class ContextReceiveController extends HttpServlet {
+ public static String SERVLET_PATH = "/case/receive-context";
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
+ resp.getWriter().println("hello");
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/HealCheckController.java
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/HealCheckController.java
new file mode 100644
index 0000000000..a1331f808a
--- /dev/null
+++
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jetty11xserver/controller/HealCheckController.java
@@ -0,0 +1,35 @@
+/*
+ * 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.jetty11xserver.controller;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+import java.io.IOException;
+
+public class HealCheckController extends HttpServlet {
+ public static String SERVLET_PATH = "/case/healthCheck";
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
+ resp.getWriter().println("hello");
+ }
+}
diff --git
a/test/plugin/scenarios/jetty-11.x-scenario/src/main/resources/log4j2.xml
b/test/plugin/scenarios/jetty-11.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..9849ed5a8a
--- /dev/null
+++ b/test/plugin/scenarios/jetty-11.x-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/jetty-11.x-scenario/support-version.list
b/test/plugin/scenarios/jetty-11.x-scenario/support-version.list
new file mode 100644
index 0000000000..140bec1629
--- /dev/null
+++ b/test/plugin/scenarios/jetty-11.x-scenario/support-version.list
@@ -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.
+
+11.0.0
+11.0.7
+11.0.15