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 2022/04/10 14:39:37 UTC
[skywalking-java] branch main updated: Add skywaliking plugin for support Apache ShenYu (incubating) gateway (#8796) (#147)
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 fab9ce53b Add skywaliking plugin for support Apache ShenYu (incubating) gateway (#8796) (#147)
fab9ce53b is described below
commit fab9ce53bda391bc989d4e45261b3fe2b146a060
Author: hutaishi <hu...@qq.com>
AuthorDate: Sun Apr 10 22:39:32 2022 +0800
Add skywaliking plugin for support Apache ShenYu (incubating) gateway (#8796) (#147)
---
.github/workflows/plugins-test.3.yaml | 1 +
.../network/trace/component/ComponentsDefine.java | 2 +
apm-sniffer/optional-plugins/pom.xml | 1 +
.../optional-plugins/shenyu-2.4.x-plugin/pom.xml | 81 +++++++
.../v24x/GlobalPluginExecuteMethodInterceptor.java | 136 +++++++++++
.../v24x/define/GlobalPluginInstrumentation.java | 73 ++++++
.../define/ServerWebExchangeInstrumentation.java | 33 +++
.../src/main/resources/skywalking-plugin.def | 18 ++
.../service-agent/java-agent/Optional-plugins.md | 3 +-
.../setup/service-agent/java-agent/Plugin-list.md | 1 +
.../service-agent/java-agent/Supported-list.md | 1 +
.../shenyu-2.4.x-scenario/config/expectedData.yaml | 120 ++++++++++
.../shenyu-2.4.x-scenario/configuration.yml | 24 ++
.../plugin/scenarios/shenyu-2.4.x-scenario/pom.xml | 91 ++++++++
.../shenyu-dist/bin/startup.sh | 29 +++
.../shenyu-2.4.x-scenario/shenyu-dist/pom.xml | 59 +++++
.../shenyu-dist/src/main/assembly/assembly.xml | 51 +++++
.../shenyu-2.4.x-scenario/shenyu-entry/pom.xml | 67 ++++++
.../testcase/shenyu/entry/EntryApplication.java | 29 +++
.../shenyu/entry/http/HttpEntryController.java | 64 ++++++
.../src/main/resources/application.yml | 18 ++
.../shenyu-2.4.x-scenario/shenyu-gateway/pom.xml | 81 +++++++
.../shenyu/gateway/GatewayApplication.java | 33 +++
.../shenyu/gateway/init/InitRouterRunner.java | 81 +++++++
.../src/main/resources/application.yml | 23 ++
.../src/main/resources/shenyu-plugin.json | 252 +++++++++++++++++++++
.../src/main/resources/shenyu-rule.json | 81 +++++++
.../src/main/resources/shenyu-selector.json | 66 ++++++
.../shenyu-2.4.x-scenario/shenyu-http/pom.xml | 67 ++++++
.../shenyu/http/ShenyuTestHttpApplication.java | 37 +++
.../shenyu/http/controller/HealthController.java | 34 +++
.../shenyu/http/controller/OrderController.java | 53 +++++
.../testcase/shenyu/http/model/dto/OrderDTO.java | 76 +++++++
.../shenyu-http/src/main/resources/application.yml | 42 ++++
.../shenyu-2.4.x-scenario/support-version.list | 18 ++
35 files changed, 1845 insertions(+), 1 deletion(-)
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 @@
<module>guava-cache-plugin</module>
<module>fastjson-1.2.x-plugin</module>
<module>jackson-2.x-plugin</module>
+ <module>shenyu-2.4.x-plugin</module>
</modules>
<dependencies>
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 @@
+<?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>optional-plugins</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.10.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>apm-shenyu-2.4.x-plugin</artifactId>
+ <name>shenyu-2.4.x-plugin</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <spring-webflux.version>5.0.0.RELEASE</spring-webflux.version>
+ </properties>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webflux</artifactId>
+ <version>${spring-webflux.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.skywalking</groupId>
+ <artifactId>apm-spring-webflux-5.x-plugin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.2.4</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <filters>
+ <filter>
+ <artifact>org.apache.skywalking:apm-spring-webflux-5.x-plugin</artifact>
+ <excludes>
+ <exclude>skywalking-plugin.def</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ 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<String> 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<Void> monoReturn = (Mono<Void>) 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<MethodDescription> 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 @@
+<?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</groupId>
+ <artifactId>shenyu-2.4.x-scenario</artifactId>
+ <version>1.0.0</version>
+ <packaging>pom</packaging>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <modules>
+ <module>shenyu-gateway</module>
+ <module>shenyu-entry</module>
+ <module>shenyu-http</module>
+ <module>shenyu-dist</module>
+ </modules>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <compiler.version>1.8</compiler.version>
+ <test.framework.version>2.4.2</test.framework.version>
+ <spring.boot.version>2.2.2.RELEASE</spring.boot.version>
+ <shenyu.gateway.version>2.4.2</shenyu.gateway.version>
+ <lombok.version>1.18.20</lombok.version>
+ <!--just for test-->
+ <fastjson.version>1.2.79</fastjson.version>
+ </properties>
+
+ <name>skywalking-shenyu-2.4.x-scenario</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring.boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-gateway</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ <!--just for test-->
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ <version>${fastjson.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+
+ <build>
+ <finalName>shenyu-2.4.x-scenario</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.10.1</version>
+ <configuration>
+ <source>${compiler.version}</source>
+ <target>${compiler.version}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<?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>shenyu-2.4.x-scenario</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-dist</artifactId>
+
+ <properties>
+ <maven.compiler.source>8</maven.compiler.source>
+ <maven.compiler.target>8</maven.compiler.target>
+ </properties>
+
+ <build>
+ <plugins>
+ <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>
\ 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 @@
+<?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>../shenyu-entry/target/shenyu-entry.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ <file>
+ <source>../shenyu-gateway/target/shenyu-gateway.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ <file>
+ <source>../shenyu-http/target/shenyu-http.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
\ 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 @@
+<?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>shenyu-2.4.x-scenario</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-entry</artifactId>
+
+ <properties>
+ <maven.compiler.source>8</maven.compiler.source>
+ <maven.compiler.target>8</maven.compiler.target>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>shenyu-entry</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring.boot.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ 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<String> httpService() throws Exception {
+ TimeUnit.MILLISECONDS.sleep(100);
+ ResponseEntity<String> 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<String> healthService() {
+ ResponseEntity<String> 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 @@
+<?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>shenyu-2.4.x-scenario</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-gateway</artifactId>
+
+ <properties>
+ <maven.compiler.source>8</maven.compiler.source>
+ <maven.compiler.target>8</maven.compiler.target>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-gateway</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>shenyu-gateway</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring.boot.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ 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<String, PluginData> pluginDataMap = JSON.parseObject(pluginStream,
+ new TypeReference<Map<String, PluginData>>() {
+ }.getType(), Feature.AllowComment);
+ Map<String, List<SelectorData>> selectorDataMap = JSON.parseObject(selectorStream,
+ new TypeReference<Map<String, List<SelectorData>>>() {
+ }.getType(), Feature.AllowComment);
+ Map<String, List<RuleData>> ruleDataMap = JSON.parseObject(ruleStream,
+ new TypeReference<Map<String, List<RuleData>>>() {
+ }.getType(), Feature.AllowComment);
+
+ pluginDataMap.values().forEach(subscriber::onSubscribe);
+ selectorDataMap.values().stream().flatMap(Collection::stream)
+ .forEach(data -> subscriber.onSelectorSubscribe(data));
+ ruleDataMap.values().stream().flatMap(Collection::stream).forEach(subscriber::onRuleSubscribe);
+
+ log.info("init router data finish.");
+ } catch (Exception e) {
+ log.error("init router failed", e);
+ }
+ }
+
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/application.yml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/application.yml
new file mode 100644
index 000000000..779366113
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/application.yml
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+server:
+ port: 9195
+
+spring:
+ main:
+ allow-bean-definition-overriding: true
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-plugin.json b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-plugin.json
new file mode 100644
index 000000000..c259149b7
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-plugin.json
@@ -0,0 +1,252 @@
+/**
+#
+# 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.
+#
+*/
+{
+ "request": {
+ "id": "20",
+ "name": "request",
+ "config": null,
+ "role": "HttpProcess",
+ "enabled": false,
+ "sort": 120
+ },
+ "jwt": {
+ "id": "19",
+ "name": "jwt",
+ "config": "{\"secretKey\":\"key\"}",
+ "role": "Authentication",
+ "enabled": false,
+ "sort": 30
+ },
+ "paramMapping": {
+ "id": "22",
+ "name": "paramMapping",
+ "config": "{\"ruleHandlePageType\":\"custom\"}",
+ "role": "HttpProcess",
+ "enabled": false,
+ "sort": 70
+ },
+ "modifyResponse": {
+ "id": "23",
+ "name": "modifyResponse",
+ "config": "{\"ruleHandlePageType\":\"custom\"}",
+ "role": "HttpProcess",
+ "enabled": false,
+ "sort": 220
+ },
+ "sign": {
+ "id": "1",
+ "name": "sign",
+ "config": null,
+ "role": "Authentication",
+ "enabled": false,
+ "sort": 20
+ },
+ "dubbo": {
+ "id": "6",
+ "name": "dubbo",
+ "config": "{\"register\":\"zookeeper://localhost:2181\",\"multiSelectorHandle\":\"1\",\"threadpool\":\"cached\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0}",
+ "role": "Proxy",
+ "enabled": false,
+ "sort": 310
+ },
+ "motan": {
+ "id": "17",
+ "name": "motan",
+ "config": "{\"register\":\"127.0.0.1:2181\"}",
+ "role": "Proxy",
+ "enabled": false,
+ "sort": 310
+ },
+ "oauth2": {
+ "id": "21",
+ "name": "oauth2",
+ "config": null,
+ "role": "Authentication",
+ "enabled": false,
+ "sort": 40
+ },
+ "rateLimiter": {
+ "id": "4",
+ "name": "rateLimiter",
+ "config": "{\"master\":\"mymaster\",\"mode\":\"standalone\",\"url\":\"192.168.1.1:6379\",\"password\":\"abc\"}",
+ "role": "FaultTolerance",
+ "enabled": false,
+ "sort": 60
+ },
+ "websocket": {
+ "id": "26",
+ "name": "websocket",
+ "config": "{\"multiSelectorHandle\":\"1\"}",
+ "role": "Proxy",
+ "enabled": true,
+ "sort": 200
+ },
+ "mqtt": {
+ "id": "28",
+ "name": "mqtt",
+ "config": "{\"port\": 9500,\"bossGroupThreadCount\": 1,\"maxPayloadSize\": 65536,\"workerGroupThreadCount\": 12,\"userName\": \"shenyu\",\"password\": \"shenyu\",\"isEncryptPassword\": false,\"encryptMode\": \"\",\"leakDetectorLevel\": \"DISABLED\"}",
+ "role": "Proxy",
+ "enabled": false,
+ "sort": 125
+ },
+ "tars": {
+ "id": "13",
+ "name": "tars tested",
+ "config": "{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\"}",
+ "role": "Proxy",
+ "enabled": false,
+ "sort": 310
+ },
+ "cryptorRequest": {
+ "id": "24",
+ "name": "cryptorRequest",
+ "config": null,
+ "role": "Cryptor",
+ "enabled": true,
+ "sort": 100
+ },
+ "divide": {
+ "id": "5",
+ "name": "divide",
+ "config": "{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\"}",
+ "role": "Proxy",
+ "enabled": true,
+ "sort": 200
+ },
+ "waf": {
+ "id": "2",
+ "name": "waf",
+ "config": "{\"model\":\"black\"}",
+ "role": "Authentication",
+ "enabled": false,
+ "sort": 50
+ },
+ "redirect": {
+ "id": "16",
+ "name": "redirect",
+ "config": null,
+ "role": "HttpProcess",
+ "enabled": false,
+ "sort": 110
+ },
+ "sentinel": {
+ "id": "10",
+ "name": "sentinel",
+ "config": null,
+ "role": "FaultTolerance",
+ "enabled": false,
+ "sort": 140
+ },
+ "hystrix": {
+ "id": "9",
+ "name": "hystrix",
+ "config": null,
+ "role": "FaultTolerance",
+ "enabled": false,
+ "sort": 130
+ },
+ "sofa": {
+ "id": "11",
+ "name": "sofa",
+ "config": "{\"protocol\":\"zookeeper\",\"register\":\"127.0.0.1:2181\"}",
+ "role": "Proxy",
+ "enabled": false,
+ "sort": 310
+ },
+ "cache": {
+ "id": "30",
+ "name": "cache",
+ "config": "{\"cacheType\":\"memory\"}",
+ "role": "Cache",
+ "enabled": false,
+ "sort": 10
+ },
+ "contextPath": {
+ "id": "14",
+ "name": "contextPath",
+ "config": null,
+ "role": "HttpProcess",
+ "enabled": true,
+ "sort": 80
+ },
+ "generalContext": {
+ "id": "27",
+ "name": "generalContext",
+ "config": null,
+ "role": "Common",
+ "enabled": true,
+ "sort": 125
+ },
+ "rewrite": {
+ "id": "3",
+ "name": "rewrite",
+ "config": null,
+ "role": "HttpProcess",
+ "enabled": false,
+ "sort": 90
+ },
+ "springCloud": {
+ "id": "8",
+ "name": "springCloud",
+ "config": null,
+ "role": "Proxy",
+ "enabled": false,
+ "sort": 200
+ },
+ "grpc": {
+ "id": "15",
+ "name": "grpc",
+ "config": "{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"cached\"}",
+ "role": "Proxy",
+ "enabled": false,
+ "sort": 310
+ },
+ "resilience4j": {
+ "id": "12",
+ "name": "resilience4j",
+ "config": null,
+ "role": "FaultTolerance",
+ "enabled": false,
+ "sort": 310
+ },
+ "logging": {
+ "id": "18",
+ "name": "logging",
+ "config": null,
+ "role": "Logging",
+ "enabled": false,
+ "sort": 160
+ },
+ "cryptorResponse": {
+ "id": "25",
+ "name": "cryptorResponse",
+ "config": null,
+ "role": "Cryptor",
+ "enabled": true,
+ "sort": 410
+ },
+ "loggingRocketMQ": {
+ "id": "29",
+ "name": "loggingRocketMQ",
+ "config": "{\"topic\":\"shenyu-access-logging\", \"namesrvAddr\": \"localhost:9876\",\"producerGroup\":\"shenyu-plugin-logging-rocketmq\"}",
+ "role": "Logging",
+ "enabled": false,
+ "sort": 170
+ }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-rule.json b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-rule.json
new file mode 100644
index 000000000..4761dea7b
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-rule.json
@@ -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.
+#
+*/
+{
+ "1": [
+ {
+ "id": "1512230008290160640",
+ "name": "/http",
+ "pluginName": "contextPath",
+ "selectorId": "1",
+ "matchMode": 0,
+ "sort": 1,
+ "enabled": true,
+ "loged": true,
+ "handle": "{\"contextPath\":\"/http\"}",
+ "conditionDataList": [
+ {
+ "paramType": "uri",
+ "operator": "match",
+ "paramName": "/",
+ "paramValue": "/http/**"
+ }
+ ]
+ }
+ ],
+ "2": [
+ {
+ "id": "1",
+ "name": "/http/order/findById",
+ "pluginName": "divide",
+ "selectorId": "2",
+ "matchMode": 0,
+ "sort": 1,
+ "enabled": true,
+ "loged": true,
+ "handle": "{\"loadBalance\":\"random\",\"retryStrategy\":\"current\",\"retry\":3,\"timeout\":3000,\"headerMaxSize\":10240,\"requestMaxSize\":102400}",
+ "conditionDataList": [
+ {
+ "paramType": "uri",
+ "operator": "=",
+ "paramName": "/",
+ "paramValue": "/http/order/findById"
+ }
+ ]
+ },
+ {
+ "id": "2",
+ "name": "/http/health/check",
+ "pluginName": "divide",
+ "selectorId": "2",
+ "matchMode": 0,
+ "sort": 1,
+ "enabled": true,
+ "loged": true,
+ "handle": "{\"loadBalance\":\"random\",\"retryStrategy\":\"current\",\"retry\":3,\"timeout\":3000,\"headerMaxSize\":10240,\"requestMaxSize\":102400}",
+ "conditionDataList": [
+ {
+ "paramType": "uri",
+ "operator": "=",
+ "paramName": "/",
+ "paramValue": "/http/health/check"
+ }
+ ]
+ }
+ ]
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-selector.json b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-selector.json
new file mode 100644
index 000000000..6c96d1188
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-gateway/src/main/resources/shenyu-selector.json
@@ -0,0 +1,66 @@
+/**
+#
+# 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.
+#
+*/
+{
+ "contextPath": [
+ {
+ "id": "1",
+ "pluginId": "14",
+ "pluginName": "contextPath",
+ "name": "/http",
+ "matchMode": 0,
+ "type": 1,
+ "sort": 1,
+ "enabled": true,
+ "logged": true,
+ "continued": true,
+ "handle": null,
+ "conditionList": [
+ {
+ "paramType": "uri",
+ "operator": "match",
+ "paramName": "/",
+ "paramValue": "/http/**"
+ }
+ ]
+ }
+ ],
+ "divide": [
+ {
+ "id": "2",
+ "pluginId": "5",
+ "pluginName": "divide",
+ "name": "/http",
+ "matchMode": 0,
+ "type": 1,
+ "sort": 1,
+ "enabled": true,
+ "logged": true,
+ "continued": true,
+ "handle": "[{\"weight\":50,\"warmup\":10,\"protocol\":\"http://\",\"upstreamHost\":\"localhost\",\"upstreamUrl\":\"localhost:8189\",\"status\":true,\"timestamp\":1649378707380}]",
+ "conditionList": [
+ {
+ "paramType": "uri",
+ "operator": "match",
+ "paramName": "/",
+ "paramValue": "/http/**"
+ }
+ ]
+ }
+ ]
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/pom.xml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/pom.xml
new file mode 100644
index 000000000..2d91b4d5a
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/pom.xml
@@ -0,0 +1,67 @@
+<?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>shenyu-2.4.x-scenario</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-http</artifactId>
+
+ <properties>
+ <maven.compiler.source>8</maven.compiler.source>
+ <maven.compiler.target>8</maven.compiler.target>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>shenyu-http</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring.boot.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/ShenyuTestHttpApplication.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/ShenyuTestHttpApplication.java
new file mode 100644
index 000000000..a360c60ab
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/ShenyuTestHttpApplication.java
@@ -0,0 +1,37 @@
+/*
+ * 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.http;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * test http service.
+ */
+@SpringBootApplication
+public class ShenyuTestHttpApplication {
+
+ /**
+ * main.
+ *
+ * @param args args
+ */
+ public static void main(final String[] args) {
+ SpringApplication.run(ShenyuTestHttpApplication.class, args);
+ }
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/controller/HealthController.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/controller/HealthController.java
new file mode 100644
index 000000000..16212f7f5
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/controller/HealthController.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package test.apache.skywalking.apm.testcase.shenyu.http.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * http health check endpoint.
+ */
+@RestController
+@RequestMapping("/health")
+public class HealthController {
+
+ @RequestMapping("/check")
+ public String healthCheck() {
+ return "ok";
+ }
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/controller/OrderController.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/controller/OrderController.java
new file mode 100644
index 000000000..68731df58
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/controller/OrderController.java
@@ -0,0 +1,53 @@
+/*
+ * 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.http.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import test.apache.skywalking.apm.testcase.shenyu.http.model.dto.OrderDTO;
+
+/**
+ * TestController.
+ */
+@RestController
+@RequestMapping("/order")
+
+public class OrderController {
+
+ /**
+ * Find by id order dto.
+ *
+ * @param id the id
+ * @return the order dto
+ */
+ @GetMapping("/findById")
+ public OrderDTO findById(@RequestParam(value = "id", required = false, defaultValue = "1") final String id) {
+ return build(id, "hello world findById");
+ }
+
+ private OrderDTO build(final String id, final String name) {
+ OrderDTO orderDTO = new OrderDTO();
+ orderDTO.setId(id);
+ orderDTO.setName(name);
+ return orderDTO;
+ }
+
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/model/dto/OrderDTO.java b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/model/dto/OrderDTO.java
new file mode 100644
index 000000000..b8250cd24
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/java/test/apache/skywalking/apm/testcase/shenyu/http/model/dto/OrderDTO.java
@@ -0,0 +1,76 @@
+/*
+ * 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.http.model.dto;
+
+import java.io.Serializable;
+import java.util.StringJoiner;
+
+/**
+ * The type Order dto.
+ */
+public class OrderDTO implements Serializable {
+
+ private String id;
+
+ private String name;
+
+ /**
+ * Get id.
+ *
+ * @return id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Set id.
+ *
+ * @param id id
+ */
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ /**
+ * Get name.
+ *
+ * @return name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set name.
+ *
+ * @param name name
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return new StringJoiner(", ", OrderDTO.class.getSimpleName() + "[", "]")
+ .add("id='" + id + "'")
+ .add("name='" + name + "'")
+ .toString();
+ }
+
+}
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/resources/application.yml b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/resources/application.yml
new file mode 100644
index 000000000..4762c9f72
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.x-scenario/shenyu-http/src/main/resources/application.yml
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+server:
+ port: 8189
+ address: 0.0.0.0
+
+shenyu:
+ register:
+ registerType: http #zookeeper #etcd #nacos #consul
+ serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379 #localhost:8848
+ props:
+ username: admin
+ password: 123456
+ client:
+ http:
+ props:
+ contextPath: /http
+ appName: http
+# port: 8189
+
+logging:
+ level:
+ root: info
+ org.springframework.boot: info
+ org.apache.ibatis: info
+ org.apache.shenyu.test.bonuspoint: info
+ org.apache.shenyu.test.lottery: debug
+ org.apache.shenyu.test: debug
+
diff --git a/test/plugin/scenarios/shenyu-2.4.x-scenario/support-version.list b/test/plugin/scenarios/shenyu-2.4.x-scenario/support-version.list
new file mode 100644
index 000000000..c470a193d
--- /dev/null
+++ b/test/plugin/scenarios/shenyu-2.4.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.
+
+# lists your version here (Contains only the last version number of each minor version.)
+2.4.2