You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/05/02 09:19:21 UTC
[skywalking-java] branch main updated: support jersey rest framework (#520)
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 dc9f7d130d support jersey rest framework (#520)
dc9f7d130d is described below
commit dc9f7d130d0378cc9b68330a86e9e22ce60a465c
Author: xu1009 <29...@qq.com>
AuthorDate: Tue May 2 17:19:15 2023 +0800
support jersey rest framework (#520)
---
.github/workflows/plugins-jdk17-test.0.yaml | 1 +
.github/workflows/plugins-test.2.yaml | 2 +
CHANGES.md | 1 +
.../network/trace/component/ComponentsDefine.java | 6 +-
.../apm-sdk-plugin/jersey-2.x-plugin/pom.xml | 42 +++++++
.../jersey/v2/ApplicationHandlerInterceptor.java | 74 +++++++++++
.../define/ApplicationHandlerInstrumentation.java | 80 ++++++++++++
.../src/main/resources/skywalking-plugin.def | 18 +++
.../apm-sdk-plugin/jersey-3.x-plugin/pom.xml | 42 +++++++
.../jersey/v3/ApplicationHandlerInterceptor.java | 74 +++++++++++
.../define/ApplicationHandlerInstrumentation.java | 80 ++++++++++++
.../src/main/resources/skywalking-plugin.def | 18 +++
apm-sniffer/apm-sdk-plugin/pom.xml | 2 +
.../setup/service-agent/java-agent/Plugin-list.md | 2 +
.../service-agent/java-agent/Supported-list.md | 1 +
.../jersey-2.0.x-2.25.x-scenario/bin/startup.sh | 21 ++++
.../config/expectedData.yaml | 73 +++++++++++
.../jersey-2.0.x-2.25.x-scenario/configuration.yml | 22 ++++
.../scenarios/jersey-2.0.x-2.25.x-scenario/pom.xml | 135 ++++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++
.../apm/testcase/jersey2xto25x/Application.java | 55 ++++++++
.../jersey2xto25x/controller/CaseController.java | 63 ++++++++++
.../src/main/resources/log4j2.xml | 30 +++++
.../support-version.list | 20 +++
.../jersey-2.26.x-2.39.x-scenario/bin/startup.sh | 21 ++++
.../config/expectedData.yaml | 73 +++++++++++
.../configuration.yml | 22 ++++
.../jersey-2.26.x-2.39.x-scenario/pom.xml | 139 +++++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++
.../apm/testcase/jersey26xto39x/Application.java | 55 ++++++++
.../jersey26xto39x/controller/CaseController.java | 63 ++++++++++
.../src/main/resources/log4j2.xml | 30 +++++
.../support-version.list | 20 +++
.../scenarios/jersey-3.x-scenario/bin/startup.sh | 21 ++++
.../jersey-3.x-scenario/config/expectedData.yaml | 73 +++++++++++
.../jersey-3.x-scenario/configuration.yml | 22 ++++
test/plugin/scenarios/jersey-3.x-scenario/pom.xml | 139 +++++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++
.../apm/testcase/jersey3x/Application.java | 54 ++++++++
.../jersey3x/controller/CaseController.java | 63 ++++++++++
.../src/main/resources/log4j2.xml | 30 +++++
.../jersey-3.x-scenario/support-version.list | 18 +++
42 files changed, 1826 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/plugins-jdk17-test.0.yaml b/.github/workflows/plugins-jdk17-test.0.yaml
index 808d22d0a9..678acb3b52 100644
--- a/.github/workflows/plugins-jdk17-test.0.yaml
+++ b/.github/workflows/plugins-jdk17-test.0.yaml
@@ -57,6 +57,7 @@ jobs:
case:
- jdk17-with-gson-scenario
- resttemplate-6.x-scenario
+ - jersey-3.x-scenario
- jetty-thread-pool-scenario
- jetty-11.x-thread-pool-scenario
steps:
diff --git a/.github/workflows/plugins-test.2.yaml b/.github/workflows/plugins-test.2.yaml
index 1b6ecaa9f9..08f37fb321 100644
--- a/.github/workflows/plugins-test.2.yaml
+++ b/.github/workflows/plugins-test.2.yaml
@@ -77,6 +77,8 @@ jobs:
- cxf-scenario
- okhttp2-scenario
- rocketmq-scenario
+ - jersey-2.0.x-2.25.x-scenario
+ - jersey-2.26.x-2.39.x-scenario
steps:
- uses: actions/checkout@v2
with:
diff --git a/CHANGES.md b/CHANGES.md
index 808e7621a5..57548a3eb8 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -9,6 +9,7 @@ Release Notes.
* Support ForkJoinPool trace
* Support clickhouse-jdbc-plugin trace sql parameters
* Support monitor jetty server work thread pool metric
+* Support Jersey REST framework
#### Documentation
diff --git a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
index 283d642c34..9bf62e3fe4 100755
--- a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
+++ b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
@@ -196,7 +196,7 @@ public class ComponentsDefine {
public static final OfficialComponent DOLPHIN_SCHEDULER = new OfficialComponent(106, "dolphinscheduler");
public static final OfficialComponent JSON_RPC = new OfficialComponent(107, "JsonRpc");
-
+
public static final OfficialComponent SEATA = new OfficialComponent(108, "Seata");
public static final OfficialComponent MYBATIS = new OfficialComponent(109, "MyBatis");
@@ -204,7 +204,7 @@ public class ComponentsDefine {
public static final OfficialComponent NEO4J = new OfficialComponent(112, "Neo4j");
public static final OfficialComponent SENTINEL = new OfficialComponent(113, "Sentinel");
-
+
public static final OfficialComponent GUAVA_CACHE = new OfficialComponent(114, "GuavaCache");
public static final OfficialComponent ALIBABA_DRUID = new OfficialComponent(115, "AlibabaDruid");
@@ -233,4 +233,6 @@ public class ComponentsDefine {
public static final OfficialComponent MICROMETER = new OfficialComponent(141, "Micrometer");
+ public static final OfficialComponent JERSEY = new OfficialComponent(146, "Jersey");
+
}
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/pom.xml
new file mode 100644
index 0000000000..29c6d3f4bb
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/pom.xml
@@ -0,0 +1,42 @@
+<?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">
+ <parent>
+ <artifactId>apm-sdk-plugin</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.16.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>apm-jersey-2.x-plugin</artifactId>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>2.21</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v2/ApplicationHandlerInterceptor.java b/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v2/ApplicationHandlerInterceptor.java
new file mode 100644
index 0000000000..a17c46f88d
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v2/ApplicationHandlerInterceptor.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jersey.v2;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+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.agent.core.util.CollectionUtil;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+import org.glassfish.jersey.server.ContainerRequest;
+
+public class ApplicationHandlerInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
+ MethodInterceptResult result) throws Throwable {
+ ContainerRequest request = (ContainerRequest) allArguments[0];
+ final ContextCarrier carrier = new ContextCarrier();
+ CarrierItem items = carrier.items();
+ while (items.hasNext()) {
+ items = items.next();
+ Map<String, List<String>> headerMap = request.getHeaders();
+ List<String> values = headerMap.get(items.getHeadKey());
+ if (!CollectionUtil.isEmpty(values)) {
+ items.setHeadValue(values.get(0));
+ }
+ }
+ String operationName = String.join(":", request.getMethod(), request.getPath(false));
+ final AbstractSpan span = ContextManager.createEntrySpan(operationName, carrier);
+ final String url = request.getRequestUri().toString();
+ Tags.URL.set(span, url);
+ Tags.HTTP.METHOD.set(span, request.getMethod());
+ span.setComponent(ComponentsDefine.JERSEY);
+ SpanLayer.asHttp(span);
+ }
+
+ @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);
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v2/define/ApplicationHandlerInstrumentation.java b/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v2/define/ApplicationHandlerInstrumentation.java
new file mode 100644
index 0000000000..25cc7d3986
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v2/define/ApplicationHandlerInstrumentation.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.jersey.v2.define;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.returns;
+
+import java.util.Collections;
+import java.util.List;
+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;
+
+public class ApplicationHandlerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+ private static final String ENHANCE_CLASS = "org.glassfish.jersey.server.ApplicationHandler";
+
+ private static final String HANDLE_METHOD_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jersey.v2.ApplicationHandlerInterceptor";
+
+ @Override
+ protected ClassMatch enhanceClass() {
+ return NameMatch.byName(ENHANCE_CLASS);
+ }
+
+ @Override
+ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription> getMethodsMatcher() {
+ return named("handle");
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return HANDLE_METHOD_INTERCEPTOR;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ protected List<WitnessMethod> witnessMethods() {
+ return Collections.singletonList(new WitnessMethod(
+ "org.glassfish.jersey.message.internal.InboundMessageContext",
+ named("getHeaders").and(returns(named("javax.ws.rs.core.MultivaluedMap")))
+ ));
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/jersey-2.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 0000000000..ae9e2105fe
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-2.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.
+
+jersey-2.x=org.apache.skywalking.apm.plugin.jersey.v2.define.ApplicationHandlerInstrumentation
+
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/pom.xml
new file mode 100644
index 0000000000..3e6295942b
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/pom.xml
@@ -0,0 +1,42 @@
+<?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">
+ <parent>
+ <artifactId>apm-sdk-plugin</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.16.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>apm-jersey-3.x-plugin</artifactId>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>3.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v3/ApplicationHandlerInterceptor.java b/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v3/ApplicationHandlerInterceptor.java
new file mode 100644
index 0000000000..0b2304a295
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v3/ApplicationHandlerInterceptor.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.jersey.v3;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+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.agent.core.util.CollectionUtil;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+import org.glassfish.jersey.server.ContainerRequest;
+
+public class ApplicationHandlerInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
+ MethodInterceptResult result) throws Throwable {
+ ContainerRequest request = (ContainerRequest) allArguments[0];
+ final ContextCarrier carrier = new ContextCarrier();
+ CarrierItem items = carrier.items();
+ while (items.hasNext()) {
+ items = items.next();
+ Map<String, List<String>> headerMap = request.getHeaders();
+ List<String> values = headerMap.get(items.getHeadKey());
+ if (!CollectionUtil.isEmpty(values)) {
+ items.setHeadValue(values.get(0));
+ }
+ }
+ String operationName = String.join(":", request.getMethod(), request.getPath(false));
+ final AbstractSpan span = ContextManager.createEntrySpan(operationName, carrier);
+ final String url = request.getRequestUri().toString();
+ Tags.URL.set(span, url);
+ Tags.HTTP.METHOD.set(span, request.getMethod());
+ span.setComponent(ComponentsDefine.JERSEY);
+ SpanLayer.asHttp(span);
+ }
+
+ @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);
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v3/define/ApplicationHandlerInstrumentation.java b/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v3/define/ApplicationHandlerInstrumentation.java
new file mode 100644
index 0000000000..dfb84d4ca9
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jersey/v3/define/ApplicationHandlerInstrumentation.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.jersey.v3.define;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.returns;
+
+import java.util.Collections;
+import java.util.List;
+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;
+
+public class ApplicationHandlerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+ private static final String ENHANCE_CLASS = "org.glassfish.jersey.server.ApplicationHandler";
+
+ private static final String HANDLE_METHOD_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jersey.v3.ApplicationHandlerInterceptor";
+
+ @Override
+ protected ClassMatch enhanceClass() {
+ return NameMatch.byName(ENHANCE_CLASS);
+ }
+
+ @Override
+ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription> getMethodsMatcher() {
+ return named("handle");
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return HANDLE_METHOD_INTERCEPTOR;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ protected List<WitnessMethod> witnessMethods() {
+ return Collections.singletonList(new WitnessMethod(
+ "org.glassfish.jersey.message.internal.InboundMessageContext",
+ named("getHeaders").and(returns(named("jakarta.ws.rs.core.MultivaluedMap")))
+ ));
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/jersey-3.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 0000000000..cdd73f2008
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/jersey-3.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.
+
+jersey-3.x=org.apache.skywalking.apm.plugin.jersey.v3.define.ApplicationHandlerInstrumentation
+
diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml
index 2cbe18b168..508ea1b673 100644
--- a/apm-sniffer/apm-sdk-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/pom.xml
@@ -127,6 +127,8 @@
<module>impala-jdbc-2.6.x-plugin</module>
<module>apm-armeria-plugins</module>
<module>jetty-thread-pool-plugin</module>
+ <module>jersey-2.x-plugin</module>
+ <module>jersey-3.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 4b7a843877..6c0c26a2d4 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -159,3 +159,5 @@
- impala-jdbc-2.6.x
- jdk-forkjoinpool-plugin
- jetty-thread-pool
+- jersey-2.x
+- jersey-3.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 86dbd10b1e..b4123fda69 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -22,6 +22,7 @@ metrics based on the tracing data.
* [Light4J Microservices Framework](https://doc.networknt.com/) 1.6.x -> 2.x
* [Netty SocketIO](https://github.com/mrniko/netty-socketio) 1.x
* [Micronaut HTTP Server](https://github.com/micronaut-projects/micronaut-core) 3.2.x -> 3.6.x
+ * [Jersey REST framework](https://github.com/eclipse-ee4j/jersey) 2.x -> 3.x
* HTTP Client
* [Feign](https://github.com/OpenFeign/feign) 9.x
* [Netflix Spring Cloud Feign](https://github.com/spring-cloud/spring-cloud-openfeign) 1.1.x -> 2.x
diff --git a/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/bin/startup.sh b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/bin/startup.sh
new file mode 100644
index 0000000000..00259e3267
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.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/jersey-2.0.x-2.25.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/config/expectedData.yaml
new file mode 100644
index 0000000000..0c1e3ba4e3
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/config/expectedData.yaml
@@ -0,0 +1,73 @@
+# 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: jersey-2.0.x-2.25.x-scenario
+ segmentSize: ge 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: not null
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 146
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: url, value: 'http://127.0.0.1:18080/jersey-2.0.x-2.25.x-scenario/case/receiveContext'}
+ - {key: http.method, value: GET}
+ refs:
+ - {parentEndpoint: not null, networkAddress: '127.0.0.1:18080',
+ refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: jersey-2.0.x-2.25.x-scenario,
+ traceId: not null}
+ - segmentId: not null
+ spans:
+ - operationName: /jersey-2.0.x-2.25.x-scenario/case/receiveContext
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 12
+ isError: false
+ spanType: Exit
+ peer: 127.0.0.1:18080
+ skipAnalysis: false
+ tags:
+ - {key: http.method, value: GET}
+ - {key: url, value: 'http://127.0.0.1:18080/jersey-2.0.x-2.25.x-scenario/case/receiveContext'}
+ - {key: http.status_code, value: '200'}
+ - operationName: not null
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 146
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: url, value: 'http://localhost:18080/jersey-2.0.x-2.25.x-scenario/case/jersey-2.0.x-2.25.x-scenario'}
+ - {key: http.method, value: GET}
+
diff --git a/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/configuration.yml b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/configuration.yml
new file mode 100644
index 0000000000..406fdd54f2
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.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/jersey-2.0.x-2.25.x-scenario/case/jersey-2.0.x-2.25.x-scenario
+healthCheck: http://localhost:18080/jersey-2.0.x-2.25.x-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+dependencies:
diff --git a/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/pom.xml b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/pom.xml
new file mode 100644
index 0000000000..13c0ce994c
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/pom.xml
@@ -0,0 +1,135 @@
+<?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>jersey-2.0.x-2.25.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>2.21</test.framework.version>
+ </properties>
+
+ <name>skywalking-jersey-2.0.x-2.25.x-scenario</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey</groupId>
+ <artifactId>jersey-bom</artifactId>
+ <version>${test.framework.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-grizzly2-http</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <finalName>jersey-2.0.x-2.25.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.jersey2xto25x.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/jersey-2.0.x-2.25.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000000..792c039751
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.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}/jersey-2.0.x-2.25.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git a/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey2xto25x/Application.java b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey2xto25x/Application.java
new file mode 100644
index 0000000000..d62eb1ec20
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey2xto25x/Application.java
@@ -0,0 +1,55 @@
+/*
+ * 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.jersey2xto25x;
+
+import java.io.IOException;
+import java.net.URI;
+import org.glassfish.grizzly.http.server.HttpServer;
+import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+
+public class Application {
+
+ // Base URI the Grizzly HTTP server will listen on
+ public static final String BASE_URI = "http://127.0.0.1:18080/jersey-2.0.x-2.25.x-scenario/";
+
+ /**
+ * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
+ *
+ * @return Grizzly HTTP server.
+ */
+ public static HttpServer startServer() {
+ // create a resource config that scans for JAX-RS resources and providers
+ // in com.example package
+ final ResourceConfig rc = new ResourceConfig().packages(
+ "org.apache.skywalking.apm.testcase.jersey2xto25x.controller");
+
+ // create and start a new instance of grizzly http server
+ // exposing the Jersey application at BASE_URI
+ return GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
+ }
+
+ public static void main(String[] args) throws IOException, InterruptedException {
+ final HttpServer server = startServer();
+ server.start();
+ System.out.printf("Jersey app started with WADL available at "
+ + "%sapplication.wadl\nHit enter to stop it...%n", BASE_URI);
+ Thread.sleep(10000000);
+ }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey2xto25x/controller/CaseController.java b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey2xto25x/controller/CaseController.java
new file mode 100644
index 0000000000..db730c2fc3
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey2xto25x/controller/CaseController.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.testcase.jersey2xto25x.controller;
+
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Request;
+import java.io.IOException;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+@Path("case")
+public class CaseController {
+
+ @Path("jersey-2.0.x-2.25.x-scenario")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getIt() {
+ // use okhttp request
+ Request request = new Request.Builder().url(
+ "http://127.0.0.1:18080/jersey-2.0.x-2.25.x-scenario/case/receiveContext")
+ .build();
+ try {
+ new OkHttpClient().newCall(request).execute();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return "Got it!";
+ }
+
+ @Path("healthCheck")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String helloWorld() {
+ return "Hello";
+ }
+
+ @Path("receiveContext")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String test() {
+ return "test";
+ }
+
+}
+
diff --git a/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..9849ed5a8a
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.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/jersey-2.0.x-2.25.x-scenario/support-version.list b/test/plugin/scenarios/jersey-2.0.x-2.25.x-scenario/support-version.list
new file mode 100644
index 0000000000..b5013fd070
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.0.x-2.25.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.
+
+2.0.1
+2.9.1
+2.19
+2.25.1
diff --git a/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/bin/startup.sh b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/bin/startup.sh
new file mode 100644
index 0000000000..07494ec995
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.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/jersey-2.26.x-2.39.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/config/expectedData.yaml
new file mode 100644
index 0000000000..1bae35e937
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/config/expectedData.yaml
@@ -0,0 +1,73 @@
+# 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: jersey-2.26.x-2.39.x-scenario
+ segmentSize: ge 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: not null
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 146
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: url, value: 'http://127.0.0.1:18080/jersey-2.26.x-2.39.x-scenario/case/receiveContext'}
+ - {key: http.method, value: GET}
+ refs:
+ - {parentEndpoint: not null, networkAddress: '127.0.0.1:18080',
+ refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: jersey-2.26.x-2.39.x-scenario,
+ traceId: not null}
+ - segmentId: not null
+ spans:
+ - operationName: /jersey-2.26.x-2.39.x-scenario/case/receiveContext
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 12
+ isError: false
+ spanType: Exit
+ peer: 127.0.0.1:18080
+ skipAnalysis: false
+ tags:
+ - {key: http.method, value: GET}
+ - {key: url, value: 'http://127.0.0.1:18080/jersey-2.26.x-2.39.x-scenario/case/receiveContext'}
+ - {key: http.status_code, value: '200'}
+ - operationName: not null
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 146
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: url, value: 'http://localhost:18080/jersey-2.26.x-2.39.x-scenario/case/jersey-2.26.x-2.39.x-scenario'}
+ - {key: http.method, value: GET}
+
diff --git a/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/configuration.yml b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/configuration.yml
new file mode 100644
index 0000000000..92891e2b30
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.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/jersey-2.26.x-2.39.x-scenario/case/jersey-2.26.x-2.39.x-scenario
+healthCheck: http://localhost:18080/jersey-2.26.x-2.39.x-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+dependencies:
diff --git a/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/pom.xml b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/pom.xml
new file mode 100644
index 0000000000..575abf47fc
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/pom.xml
@@ -0,0 +1,139 @@
+<?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>jersey-2.26.x-2.39.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>2.26</test.framework.version>
+ </properties>
+
+ <name>skywalking-jersey-2.26.x-2.39.x-scenario</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey</groupId>
+ <artifactId>jersey-bom</artifactId>
+ <version>${test.framework.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-grizzly2-http</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <finalName>jersey-2.26.x-2.39.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.jersey26xto39x.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/jersey-2.26.x-2.39.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000000..4e06d3281d
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.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}/jersey-2.26.x-2.39.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git a/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey26xto39x/Application.java b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey26xto39x/Application.java
new file mode 100644
index 0000000000..18ad792fa4
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey26xto39x/Application.java
@@ -0,0 +1,55 @@
+/*
+ * 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.jersey26xto39x;
+
+import java.io.IOException;
+import java.net.URI;
+import org.glassfish.grizzly.http.server.HttpServer;
+import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+
+public class Application {
+
+ // Base URI the Grizzly HTTP server will listen on
+ public static final String BASE_URI = "http://127.0.0.1:18080/jersey-2.26.x-2.39.x-scenario/";
+
+ /**
+ * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
+ *
+ * @return Grizzly HTTP server.
+ */
+ public static HttpServer startServer() {
+ // create a resource config that scans for JAX-RS resources and providers
+ // in com.example package
+ final ResourceConfig rc = new ResourceConfig().packages(
+ "org.apache.skywalking.apm.testcase.jersey26xto39x.controller");
+
+ // create and start a new instance of grizzly http server
+ // exposing the Jersey application at BASE_URI
+ return GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
+ }
+
+ public static void main(String[] args) throws IOException, InterruptedException {
+ final HttpServer server = startServer();
+ server.start();
+ System.out.printf("Jersey app started with WADL available at "
+ + "%sapplication.wadl\nHit enter to stop it...%n", BASE_URI);
+ Thread.sleep(10000000);
+ }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey26xto39x/controller/CaseController.java b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey26xto39x/controller/CaseController.java
new file mode 100644
index 0000000000..0f357caa3b
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey26xto39x/controller/CaseController.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.testcase.jersey26xto39x.controller;
+
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Request;
+import java.io.IOException;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+@Path("case")
+public class CaseController {
+
+ @Path("jersey-2.26.x-2.39.x-scenario")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getIt() {
+ // use okhttp request
+ Request request = new Request.Builder().url(
+ "http://127.0.0.1:18080/jersey-2.26.x-2.39.x-scenario/case/receiveContext")
+ .build();
+ try {
+ new OkHttpClient().newCall(request).execute();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return "Got it!";
+ }
+
+ @Path("healthCheck")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String helloWorld() {
+ return "Hello";
+ }
+
+ @Path("receiveContext")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String test() {
+ return "test";
+ }
+
+}
+
diff --git a/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..9849ed5a8a
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.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/jersey-2.26.x-2.39.x-scenario/support-version.list b/test/plugin/scenarios/jersey-2.26.x-2.39.x-scenario/support-version.list
new file mode 100644
index 0000000000..170fa5e836
--- /dev/null
+++ b/test/plugin/scenarios/jersey-2.26.x-2.39.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.
+
+2.26
+2.37
+2.39.1
+
diff --git a/test/plugin/scenarios/jersey-3.x-scenario/bin/startup.sh b/test/plugin/scenarios/jersey-3.x-scenario/bin/startup.sh
new file mode 100644
index 0000000000..3613f99a88
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.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/jersey-3.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/jersey-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/jersey-3.x-scenario/config/expectedData.yaml
new file mode 100644
index 0000000000..1c688c1829
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.x-scenario/config/expectedData.yaml
@@ -0,0 +1,73 @@
+# 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: jersey-3.x-scenario
+ segmentSize: ge 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: not null
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 146
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: url, value: 'http://127.0.0.1:18080/jersey-3.x-scenario/case/receiveContext'}
+ - {key: http.method, value: GET}
+ refs:
+ - {parentEndpoint: not null, networkAddress: '127.0.0.1:18080',
+ refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: jersey-3.x-scenario,
+ traceId: not null}
+ - segmentId: not null
+ spans:
+ - operationName: /jersey-3.x-scenario/case/receiveContext
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 12
+ isError: false
+ spanType: Exit
+ peer: 127.0.0.1:18080
+ skipAnalysis: false
+ tags:
+ - {key: http.method, value: GET}
+ - {key: url, value: 'http://127.0.0.1:18080/jersey-3.x-scenario/case/receiveContext'}
+ - {key: http.status_code, value: '200'}
+ - operationName: not null
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 146
+ isError: false
+ spanType: Entry
+ peer: ''
+ skipAnalysis: false
+ tags:
+ - {key: url, value: 'http://localhost:18080/jersey-3.x-scenario/case/jersey-3.x-scenario'}
+ - {key: http.method, value: GET}
+
diff --git a/test/plugin/scenarios/jersey-3.x-scenario/configuration.yml b/test/plugin/scenarios/jersey-3.x-scenario/configuration.yml
new file mode 100644
index 0000000000..9ca07e1620
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.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/jersey-3.x-scenario/case/jersey-3.x-scenario
+healthCheck: http://localhost:18080/jersey-3.x-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+dependencies:
diff --git a/test/plugin/scenarios/jersey-3.x-scenario/pom.xml b/test/plugin/scenarios/jersey-3.x-scenario/pom.xml
new file mode 100644
index 0000000000..26e1a73830
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.x-scenario/pom.xml
@@ -0,0 +1,139 @@
+<?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>jersey-3.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>3.0.1</test.framework.version>
+ </properties>
+
+ <name>skywalking-jersey-3.x-scenario</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey</groupId>
+ <artifactId>jersey-bom</artifactId>
+ <version>${test.framework.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-grizzly2-http</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <finalName>jersey-3.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.jersey3x.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/jersey-3.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/jersey-3.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000000..aecc3d2481
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.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}/jersey-3.x-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git a/test/plugin/scenarios/jersey-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey3x/Application.java b/test/plugin/scenarios/jersey-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey3x/Application.java
new file mode 100644
index 0000000000..e41202e3f4
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey3x/Application.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.jersey3x;
+
+import java.io.IOException;
+import java.net.URI;
+import org.glassfish.grizzly.http.server.HttpServer;
+import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+
+public class Application {
+
+ // Base URI the Grizzly HTTP server will listen on
+ public static final String BASE_URI = "http://127.0.0.1:18080/jersey-3.x-scenario/";
+
+ /**
+ * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
+ *
+ * @return Grizzly HTTP server.
+ */
+ public static HttpServer startServer() {
+ // create a resource config that scans for JAX-RS resources and providers
+ // in com.example package
+ final ResourceConfig rc = new ResourceConfig().packages(
+ "org.apache.skywalking.apm.testcase.jersey3x.controller");
+
+ // create and start a new instance of grizzly http server
+ // exposing the Jersey application at BASE_URI
+ return GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
+ }
+
+ public static void main(String[] args) throws IOException, InterruptedException {
+ final HttpServer server = startServer();
+ System.out.printf("Jersey app started with WADL available at "
+ + "%s application.wadl\nHit enter to stop it...%n", BASE_URI);
+ server.start();
+ }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/jersey-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey3x/controller/CaseController.java b/test/plugin/scenarios/jersey-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey3x/controller/CaseController.java
new file mode 100644
index 0000000000..4252b57387
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/jersey3x/controller/CaseController.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.testcase.jersey3x.controller;
+
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Request;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import java.io.IOException;
+
+@Path("case")
+public class CaseController {
+
+ @Path("jersey-3.x-scenario")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getIt() {
+ // use okhttp request
+ Request request = new Request.Builder().url(
+ "http://127.0.0.1:18080/jersey-3.x-scenario/case/receiveContext")
+ .build();
+ try {
+ new OkHttpClient().newCall(request).execute();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return "Got it!";
+ }
+
+ @Path("healthCheck")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String helloWorld() {
+ return "Hello";
+ }
+
+ @Path("receiveContext")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String test() {
+ return "test";
+ }
+
+}
+
diff --git a/test/plugin/scenarios/jersey-3.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/jersey-3.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..9849ed5a8a
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.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/jersey-3.x-scenario/support-version.list b/test/plugin/scenarios/jersey-3.x-scenario/support-version.list
new file mode 100644
index 0000000000..bf93530913
--- /dev/null
+++ b/test/plugin/scenarios/jersey-3.x-scenario/support-version.list
@@ -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.
+
+3.0.0
+3.1.1