diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml
index c9f74ef9e..1ef64b5da 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -97,6 +97,7 @@ jobs:
- undertow-worker-thread-pool-scenario
- tomcat-thread-pool-scenario
- guava-eventbus-scenario
+ - shenyu-2.4.x-scenario
steps:
- uses: actions/checkout@v2
with:
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 75a8b377d..e9af24846 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
@@ -220,4 +220,6 @@ public class ComponentsDefine {
public static final OfficialComponent APACHE_KYLIN_JDBC_DRIVER = new OfficialComponent(121, "apache-kylin-jdbc-driver");
public static final OfficialComponent GUAVA_EVENT_BUS = new OfficialComponent(123, "GuavaEventBus");
+
+ public static final OfficialComponent APACHE_SHENYU = new OfficialComponent(127, "Apache-ShenYu");
}
diff --git a/apm-sniffer/optional-plugins/pom.xml b/apm-sniffer/optional-plugins/pom.xml
index 308d1d9a9..074d62131 100644
--- a/apm-sniffer/optional-plugins/pom.xml
+++ b/apm-sniffer/optional-plugins/pom.xml
@@ -55,6 +55,7 @@
guava-cache-pluginfastjson-1.2.x-pluginjackson-2.x-plugin
+ shenyu-2.4.x-plugin
diff --git a/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/pom.xml b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/pom.xml
new file mode 100644
index 000000000..8ba8e1061
--- /dev/null
+++ b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/pom.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+ optional-plugins
+ org.apache.skywalking
+ 8.10.0-SNAPSHOT
+
+ 4.0.0
+
+ apm-shenyu-2.4.x-plugin
+ shenyu-2.4.x-plugin
+
+
+ UTF-8
+ 5.0.0.RELEASE
+
+
+
+
+
+ org.springframework
+ spring-webflux
+ ${spring-webflux.version}
+ provided
+
+
+ org.apache.skywalking
+ apm-spring-webflux-5.x-plugin
+ ${project.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+ org.apache.skywalking:apm-spring-webflux-5.x-plugin
+
+ skywalking-plugin.def
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java
new file mode 100644
index 000000000..be727601b
--- /dev/null
+++ b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java
@@ -0,0 +1,136 @@
+/*
+ * 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.shenyu.v24x;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+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.ContextSnapshot;
+import org.apache.skywalking.apm.agent.core.context.tag.Tags;
+import org.apache.skywalking.apm.agent.core.context.tag.Tags.HTTP;
+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.springframework.http.HttpHeaders;
+import org.springframework.web.server.ServerWebExchange;
+import org.springframework.web.server.ServerWebExchangeDecorator;
+import org.springframework.web.server.adapter.DefaultServerWebExchange;
+
+import reactor.core.publisher.Mono;
+
+/**
+ * Apache shenyu global-plugin interceptor.
+ */
+public class GlobalPluginExecuteMethodInterceptor implements InstanceMethodsAroundInterceptor {
+
+ public static final String SHENYU_AGENT_TRACE_ID = "shenyu-agent-trace-id";
+ public static final String SKYWALKING_CONTEXT_SNAPSHOT = "SKYWALKING_CONTEXT_SNAPSHOT";
+ public static final String SKYWALKING_SPAN = "SKYWALKING_SPAN";
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes,
+ MethodInterceptResult result) throws Throwable {
+ ServerWebExchange exchange = (ServerWebExchange) allArguments[0];
+
+ ContextCarrier carrier = new ContextCarrier();
+ CarrierItem next = carrier.items();
+ HttpHeaders headers = exchange.getRequest().getHeaders();
+ while (next.hasNext()) {
+ next = next.next();
+ List header = headers.get(next.getHeadKey());
+ if (header != null && header.size() > 0) {
+ next.setHeadValue(header.get(0));
+ }
+ }
+
+ AbstractSpan span = ContextManager.createEntrySpan(exchange.getRequest().getURI().getPath(), carrier);
+ span.setComponent(ComponentsDefine.APACHE_SHENYU);
+ SpanLayer.asHttp(span);
+ Tags.URL.set(span, exchange.getRequest().getURI().toString());
+ HTTP.METHOD.set(span, exchange.getRequest().getMethodValue());
+
+ ContextSnapshot snapshot = ContextManager.capture();
+ exchange.getAttributes().put(SHENYU_AGENT_TRACE_ID, snapshot.getTraceId().getId());
+ EnhancedInstance instance = getInstance(allArguments[0]);
+ instance.setSkyWalkingDynamicField(snapshot);
+ span.prepareForAsync();
+ ContextManager.stopSpan(span);
+
+ exchange.getAttributes().put(SKYWALKING_SPAN, span);
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class>[] argumentsTypes,
+ Object ret) throws Throwable {
+
+ ServerWebExchange exchange = (ServerWebExchange) allArguments[0];
+
+ AbstractSpan span = (AbstractSpan) exchange.getAttributes().get(SKYWALKING_SPAN);
+ if (Objects.isNull(span)) {
+ return ret;
+ }
+ Mono monoReturn = (Mono) ret;
+
+ // add skywalking context snapshot to reactor context. webclient plugin need to use SKYWALKING_CONTEXT_SNAPSHOT
+ EnhancedInstance instance = getInstance(allArguments[0]);
+ if (instance != null && instance.getSkyWalkingDynamicField() != null) {
+ monoReturn = monoReturn.subscriberContext(
+ c -> c.put(SKYWALKING_CONTEXT_SNAPSHOT, instance.getSkyWalkingDynamicField()));
+ }
+
+ return monoReturn
+ .doOnError(throwable -> span.errorOccurred().log(throwable))
+ .doFinally(s -> {
+ try {
+ Optional.ofNullable(exchange.getResponse().getStatusCode()).ifPresent(httpStatus -> {
+ Tags.HTTP_RESPONSE_STATUS_CODE.set(span, httpStatus.value());
+ if (httpStatus.isError()) {
+ span.errorOccurred();
+ }
+ });
+ } finally {
+ span.asyncFinish();
+ }
+ });
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
+ Class>[] argumentsTypes, Throwable t) {
+ }
+
+ public static EnhancedInstance getInstance(Object o) {
+ EnhancedInstance instance = null;
+ if (o instanceof DefaultServerWebExchange) {
+ instance = (EnhancedInstance) o;
+ } else if (o instanceof ServerWebExchangeDecorator) {
+ ServerWebExchange delegate = ((ServerWebExchangeDecorator) o).getDelegate();
+ return getInstance(delegate);
+ }
+ return instance;
+ }
+}
diff --git a/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/define/GlobalPluginInstrumentation.java b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/define/GlobalPluginInstrumentation.java
new file mode 100644
index 000000000..ddd69d62b
--- /dev/null
+++ b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/define/GlobalPluginInstrumentation.java
@@ -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.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.shenyu.v24x.define;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+
+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 net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+
+/**
+ * Apache shenyu global-plugin Instrumentation.
+ */
+public class GlobalPluginInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+ private static final String ENHANCE_CLASS = "org.apache.shenyu.plugin.global.GlobalPlugin";
+
+ private static final String INTERCEPT_CLASS =
+ "org.apache.skywalking.apm.plugin.shenyu.v24x.GlobalPluginExecuteMethodInterceptor";
+
+ @Override
+ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[] {
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher getMethodsMatcher() {
+ return named("execute");
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPT_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/define/ServerWebExchangeInstrumentation.java b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/define/ServerWebExchangeInstrumentation.java
new file mode 100644
index 000000000..d04e69f5e
--- /dev/null
+++ b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/define/ServerWebExchangeInstrumentation.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.shenyu.v24x.define;
+
+
+/**
+ * Since all plugins have access to the ServerWebExchange and the plugins are processed in asynchronous threads,
+ * we can put the snapshot into the enhanced ServerWebExchange object.
+ */
+public class ServerWebExchangeInstrumentation extends
+ org.apache.skywalking.apm.plugin.spring.webflux.v5.define.ServerWebExchangeInstrumentation {
+
+ @Override
+ protected String[] witnessClasses() {
+ return new String[]{"org.apache.shenyu.plugin.global.GlobalPlugin"};
+ }
+}
diff --git a/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 000000000..3aec1ba56
--- /dev/null
+++ b/apm-sniffer/optional-plugins/shenyu-2.4.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.
+
+shenyu-2.4.x=org.apache.skywalking.apm.plugin.shenyu.v24x.define.GlobalPluginInstrumentation
+shenyu-2.4.x=org.apache.skywalking.apm.plugin.shenyu.v24x.define.ServerWebExchangeInstrumentation
diff --git a/docs/en/setup/service-agent/java-agent/Optional-plugins.md b/docs/en/setup/service-agent/java-agent/Optional-plugins.md
index 3cbde3701..853e84846 100644
--- a/docs/en/setup/service-agent/java-agent/Optional-plugins.md
+++ b/docs/en/setup/service-agent/java-agent/Optional-plugins.md
@@ -19,4 +19,5 @@ Now, we have the following known optional plugins.
* Plugin of ehcache-2.x in the optional plugin folder. The reason for being an optional plugin is, this plugin enhanced cache framework, generates large number of local spans, which have a potential performance impact.
* Plugin of guava-cache in the optional plugin folder. The reason for being an optional plugin is, this plugin enhanced cache framework, generates large number of local spans, which have a potential performance impact.
* Plugin of fastjson serialization lib in optional plugin folder.
-* Plugin of jackson serialization lib in optional plugin folder.
\ No newline at end of file
+* Plugin of jackson serialization lib in optional plugin folder.
+* Plugin of Apache ShenYu(incubating) Gateway 2.4.x in optional plugin folder. Please only activate this plugin when you install agent in Apache ShenYu Gateway.
\ No newline at end of file
diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md
index cc1a8e3b3..213d86b89 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -136,3 +136,4 @@
- undertow-worker-thread-pool
- tomcat-thread-pool
- guava-eventbus
+- shenyu-2.4.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 b3fc63cd6..4385197f3 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -31,6 +31,7 @@ metrics based on the tracing data.
* JRE HttpURLConnection (Optional²)
* HTTP Gateway
* [Spring Cloud Gateway](https://spring.io/projects/spring-cloud-gateway) 2.0.2.RELEASE -> 3.x (Optional²)
+ * [Apache ShenYu](https://shenyu.apache.org) 2.4.x (Optional²)
* JDBC
* Mysql Driver 5.x, 6.x, 8.x
* Oracle Driver (Optional¹)
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/shenyu-2.4.x-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..8916a6b3f
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/config/expectedData.yaml
@@ -0,0 +1,120 @@
+# 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: http-provider
+ segmentSize: nq 0
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: GET:/order/findById
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 14
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value: 'http://localhost:8189/order/findById'}
+ - {key: http.method, value: GET}
+ refs:
+ - {parentEndpoint: /order/findById, networkAddress: 'localhost:8189',
+ refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: 'shenyu-gateway', traceId: not null}
+ skipAnalysis: 'false'
+
+ - serviceName: shenyu-gateway
+ segmentSize: nq 0
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /order/findById
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 99
+ isError: false
+ spanType: Exit
+ peer: 'localhost:8189'
+ tags:
+ - {key: url, value: 'http://localhost:8189/order/findById'}
+ - {key: http.method, value: GET}
+ - {key: http.status_code, value: '200'}
+ refs:
+ - { parentEndpoint: /http/order/findById, networkAddress: '',
+ refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: 'shenyu-gateway', traceId: not null }
+ skipAnalysis: 'false'
+ - segmentId: not null
+ spans:
+ - operationName: /http/order/findById
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 127
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value: 'http://localhost:9195/http/order/findById'}
+ - {key: http.method, value: GET}
+ - {key: http.status_code, value: '200'}
+ refs:
+ - { parentEndpoint: GET:/entry/http-service, networkAddress: 'localhost:9195',
+ refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
+ parentServiceInstance: not null, parentService: 'entry-service', traceId: not null }
+ skipAnalysis: 'false'
+
+ - serviceName: entry-service
+ segmentSize: nq 0
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /http/order/findById
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 13
+ isError: false
+ spanType: Exit
+ peer: 'localhost:9195'
+ tags:
+ - {key: url, value: 'http://localhost:9195/http/order/findById'}
+ - {key: http.method, value: GET}
+ skipAnalysis: 'false'
+ - operationName: GET:/entry/http-service
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 14
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - { key: url, value: 'http://localhost:8888/entry/http-service' }
+ - { key: http.method, value: GET }
+ skipAnalysis: 'false'
+
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/configuration.yml b/test/plugin/scenarios/shenyu-2.4.x-scenario/configuration.yml
new file mode 100644
index 000000000..a51522838
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/configuration.yml
@@ -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.
+
+type: jvm
+entryService: http://localhost:8888/entry/http-service
+healthCheck: http://localhost:8888/entry/health-service
+startScript: ./bin/startup.sh
+runningMode: with_optional
+withPlugins: apm-shenyu-2.4.x-plugin-*.jar
+environment:
+dependencies:
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/pom.xml b/test/plugin/scenarios/shenyu-2.4.x-scenario/pom.xml
new file mode 100644
index 000000000..31b9e2584
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/pom.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+ org.apache.skywalking
+ shenyu-2.4.x-scenario
+ 1.0.0
+ pom
+
+ 4.0.0
+
+
+ shenyu-gateway
+ shenyu-entry
+ shenyu-http
+ shenyu-dist
+
+
+
+ UTF-8
+ 1.8
+ 2.4.2
+ 2.2.2.RELEASE
+ 2.4.2
+ 1.18.20
+
+ 1.2.79
+
+
+ skywalking-shenyu-2.4.x-scenario
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring.boot.version}
+ pom
+ import
+
+
+ org.apache.shenyu
+ shenyu-spring-boot-starter-gateway
+ ${test.framework.version}
+
+
+
+ com.alibaba
+ fastjson
+ ${fastjson.version}
+
+
+
+
+
+
+ shenyu-2.4.x-scenario
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.10.1
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+
+
+
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/bin/startup.sh b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/bin/startup.sh
new file mode 100644
index 000000000..7a82388b8
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/bin/startup.sh
@@ -0,0 +1,29 @@
+#!/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} "-Dskywalking.agent.service_name=shenyu-gateway" ${home}/../libs/shenyu-gateway.jar &
+sleep 1
+
+java -jar ${agent_opts} "-Dskywalking.agent.service_name=http-provider" ${home}/../libs/shenyu-http.jar &
+sleep 1
+
+java -jar ${agent_opts} "-Dskywalking.agent.service_name=entry-service" ${home}/../libs/shenyu-entry.jar &
+sleep 1
+
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/pom.xml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/pom.xml
new file mode 100644
index 000000000..d96eb2f9d
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/pom.xml
@@ -0,0 +1,59 @@
+
+
+
+
+ shenyu-2.4.x-scenario
+ org.apache.skywalking
+ 1.0.0
+
+ 4.0.0
+
+ shenyu-dist
+
+
+ 8
+ 8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+ ../target/
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/src/main/assembly/assembly.xml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..82ba28e50
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-dist/src/main/assembly/assembly.xml
@@ -0,0 +1,51 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ../shenyu-entry/target/shenyu-entry.jar
+ ./libs
+ 0775
+
+
+ ../shenyu-gateway/target/shenyu-gateway.jar
+ ./libs
+ 0775
+
+
+ ../shenyu-http/target/shenyu-http.jar
+ ./libs
+ 0775
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/pom.xml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/pom.xml
new file mode 100644
index 000000000..7610190e6
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/pom.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+ shenyu-2.4.x-scenario
+ org.apache.skywalking
+ 1.0.0
+
+ 4.0.0
+
+ shenyu-entry
+
+
+ 8
+ 8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
+
+ shenyu-entry
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring.boot.version}
+
+
+
+ repackage
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/java/test/apache/skywalking/apm/testcase/shenyu/entry/EntryApplication.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/java/test/apache/skywalking/apm/testcase/shenyu/entry/EntryApplication.java
new file mode 100644
index 000000000..7b7a477de
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/java/test/apache/skywalking/apm/testcase/shenyu/entry/EntryApplication.java
@@ -0,0 +1,29 @@
+/*
+ * 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 test.apache.skywalking.apm.testcase.shenyu.entry;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class EntryApplication {
+
+ public static void main(final String[] args) {
+ SpringApplication.run(EntryApplication.class, args);
+ }
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/java/test/apache/skywalking/apm/testcase/shenyu/entry/http/HttpEntryController.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/java/test/apache/skywalking/apm/testcase/shenyu/entry/http/HttpEntryController.java
new file mode 100644
index 000000000..4526a6b2c
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/java/test/apache/skywalking/apm/testcase/shenyu/entry/http/HttpEntryController.java
@@ -0,0 +1,64 @@
+/*
+ * 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 test.apache.skywalking.apm.testcase.shenyu.entry.http;
+
+import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
+
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * http entry service.
+ */
+@RestController
+@RequestMapping("/entry")
+public class HttpEntryController {
+
+ private static final String ORDER_GATEWAY_URL = "http://localhost:9195/http/order/findById";
+
+ private static final String HEALTH_GATEWAY_URL = "http://localhost:9195/http/health/check";
+
+ private final RestTemplate restTemplate = new RestTemplate();
+
+ @GetMapping(value = "/http-service", produces = {APPLICATION_JSON_VALUE})
+ public ResponseEntity httpService() throws Exception {
+ TimeUnit.MILLISECONDS.sleep(100);
+ ResponseEntity entity = restTemplate.getForEntity(ORDER_GATEWAY_URL, String.class);
+ if (entity.getStatusCode().is2xxSuccessful()) {
+ return ResponseEntity.ok(Optional.ofNullable(entity.getBody()).orElse(""));
+ }
+ return ResponseEntity.status(HttpStatus.BAD_GATEWAY).body("failed");
+ }
+
+ @GetMapping(value = "/health-service", produces = {APPLICATION_JSON_VALUE})
+ public ResponseEntity healthService() {
+ ResponseEntity entity = restTemplate.getForEntity(HEALTH_GATEWAY_URL, String.class);
+ if (entity.getStatusCode().is2xxSuccessful()) {
+ return ResponseEntity.ok(Optional.ofNullable(entity.getBody()).orElse(""));
+ }
+ return ResponseEntity.status(HttpStatus.BAD_GATEWAY).body("failed");
+ }
+
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/resources/application.yml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/resources/application.yml
new file mode 100644
index 000000000..516dbbeca
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-entry/src/main/resources/application.yml
@@ -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.
+
+server:
+ port: 8888
+
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/pom.xml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/pom.xml
new file mode 100644
index 000000000..9daa7998d
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/pom.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+ shenyu-2.4.x-scenario
+ org.apache.skywalking
+ 1.0.0
+
+ 4.0.0
+
+ shenyu-gateway
+
+
+ 8
+ 8
+
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+ org.apache.shenyu
+ shenyu-spring-boot-starter-gateway
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+ com.alibaba
+ fastjson
+
+
+
+
+ shenyu-gateway
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring.boot.version}
+
+
+
+ repackage
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/java/test/apache/skywalking/apm/testcase/shenyu/gateway/GatewayApplication.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/java/test/apache/skywalking/apm/testcase/shenyu/gateway/GatewayApplication.java
new file mode 100644
index 000000000..a9b9d8917
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/java/test/apache/skywalking/apm/testcase/shenyu/gateway/GatewayApplication.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package test.apache.skywalking.apm.testcase.shenyu.gateway;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * shenyu gateway application.
+ */
+@SpringBootApplication
+public class GatewayApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(GatewayApplication.class, args);
+ }
+
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/java/test/apache/skywalking/apm/testcase/shenyu/gateway/init/InitRouterRunner.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/java/test/apache/skywalking/apm/testcase/shenyu/gateway/init/InitRouterRunner.java
new file mode 100644
index 000000000..a17c165c4
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/java/test/apache/skywalking/apm/testcase/shenyu/gateway/init/InitRouterRunner.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 test.apache.skywalking.apm.testcase.shenyu.gateway.init;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.shenyu.common.dto.PluginData;
+import org.apache.shenyu.common.dto.RuleData;
+import org.apache.shenyu.common.dto.SelectorData;
+import org.apache.shenyu.sync.data.api.PluginDataSubscriber;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.parser.Feature;
+import com.fasterxml.jackson.core.type.TypeReference;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * init gateway router runner.
+ */
+@Slf4j
+@Component
+public class InitRouterRunner implements CommandLineRunner {
+
+ @Autowired
+ private PluginDataSubscriber subscriber;
+
+ @Override
+ public void run(String... args) throws Exception {
+ String pluginPath = "/shenyu-plugin.json";
+ String selectorPath = "/shenyu-selector.json";
+ String rulePath = "/shenyu-rule.json";
+
+ try (
+ InputStream pluginStream = getClass().getResourceAsStream(pluginPath);
+ InputStream selectorStream = getClass().getResourceAsStream(selectorPath);
+ InputStream ruleStream = getClass().getResourceAsStream(rulePath)) {
+
+ Map pluginDataMap = JSON.parseObject(pluginStream,
+ new TypeReference