You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by jo...@apache.org on 2022/02/02 17:29:53 UTC
[incubator-shenyu] branch master updated: feature(integrated-test): add integrated test for tracing-zipkin moudle in agent (#2824)
This is an automated email from the ASF dual-hosted git repository.
jooks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new bb5190e feature(integrated-test): add integrated test for tracing-zipkin moudle in agent (#2824)
bb5190e is described below
commit bb5190e637db61ba48c07984716ffda885840b86
Author: luoxiaolong <28...@qq.com>
AuthorDate: Thu Feb 3 01:29:46 2022 +0800
feature(integrated-test): add integrated test for tracing-zipkin moudle in agent (#2824)
Co-authored-by: liguoping <xd...@163.com>
---
.../workflows/integrated-test-agent-tracing.yml | 1 +
.../shenyu-integrated-test-agent-tracing/pom.xml | 1 +
.../Dockerfile | 27 +++
.../docker-compose.yml | 90 +++++++++
.../pom.xml | 108 ++++++++++
.../script/healthcheck.sh | 36 ++++
.../script/services.list | 19 ++
.../src/main/assembly/binary.xml | 90 +++++++++
.../agent/zipkin/ZipkinIntegratedBootstrap.java | 37 ++++
.../src/main/resources/application.yml | 52 +++++
.../src/main/resources/bin/start.sh | 65 ++++++
.../src/main/resources/bin/stop.sh | 51 +++++
.../src/main/resources/conf/logback.xml} | 34 ++--
.../src/main/resources/conf/shenyu-agent.yaml | 44 ++++
.../src/main/resources/conf/tracing-point.yaml | 221 +++++++++++++++++++++
.../test/agent/zipkin/ZipkinPluginTest.java | 86 ++++++++
.../test/agent/zipkin/result/ZipkinSpan.java | 166 ++++++++++++++++
17 files changed, 1110 insertions(+), 18 deletions(-)
diff --git a/.github/workflows/integrated-test-agent-tracing.yml b/.github/workflows/integrated-test-agent-tracing.yml
index e24eca5..45d9991 100644
--- a/.github/workflows/integrated-test-agent-tracing.yml
+++ b/.github/workflows/integrated-test-agent-tracing.yml
@@ -27,6 +27,7 @@ jobs:
matrix:
case:
- shenyu-integrated-test-agent-tracing-opentelemetry
+ - shenyu-integrated-test-agent-tracing-zipkin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/pom.xml
index 289b7eb..22dd572 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/pom.xml
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/pom.xml
@@ -30,6 +30,7 @@
<modules>
<module>shenyu-integrated-test-agent-tracing-opentelemetry</module>
+ <module>shenyu-integrated-test-agent-tracing-zipkin</module>
</modules>
</project>
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/Dockerfile b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/Dockerfile
new file mode 100644
index 0000000..a49889f
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/Dockerfile
@@ -0,0 +1,27 @@
+# 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.
+
+FROM openjdk:8-jre-alpine
+
+ENV APP_NAME shenyu-integrated-test-agent-tracing-zipkin
+ENV LOCAL_PATH /opt/${APP_NAME}
+
+ADD target/${APP_NAME} ${LOCAL_PATH}
+
+WORKDIR ${LOCAL_PATH}
+EXPOSE 9195
+
+CMD /bin/sh ${LOCAL_PATH}/bin/start.sh agent && tail -f ${LOCAL_PATH}/logs/shenyu-bootstrap.log
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/docker-compose.yml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/docker-compose.yml
new file mode 100644
index 0000000..5e9abab
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/docker-compose.yml
@@ -0,0 +1,90 @@
+# 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.
+version: "3.9"
+services:
+ shenyu-zipkin:
+ image: "openzipkin/zipkin:latest"
+ container_name: shenyu-zipkin
+ restart: always
+ networks:
+ - shenyu
+ ports:
+ - "9411:9411"
+
+ shenyu-admin:
+ image: apache/shenyu-admin:latest
+ container_name: shenyu-admin
+ restart: always
+ networks:
+ - shenyu
+ ports:
+ - "9095:9095"
+ environment:
+ - SPRING_PROFILES_ACTIVE=h2
+ - shenyu.database.init_script=sql-script/h2/schema.sql
+ healthcheck:
+ test: [ "CMD-SHELL", "wget -q -O - http://shenyu-admin:9095/actuator/health | grep UP || exit 1" ]
+ timeout: 2s
+ retries: 30
+ depends_on:
+ - shenyu-zipkin
+
+ shenyu-integrated-test-agent-tracing-zipkin:
+ deploy:
+ resources:
+ limits:
+ memory: 2048M
+ container_name: shenyu-integrated-test-agent-tracing-zipkin
+ image: apache/shenyu-integrated-test-agent-tracing-zipkin:latest
+ restart: always
+ depends_on:
+ shenyu-admin:
+ condition: service_healthy
+ ports:
+ - "9195:9195"
+ networks:
+ - shenyu
+ healthcheck:
+ test: [ "CMD", "wget", "http://shenyu-integrated-test-agent-tracing-zipkin:9195/actuator/health" ]
+ timeout: 2s
+ retries: 30
+
+ shenyu-examples-http:
+ deploy:
+ resources:
+ limits:
+ memory: 2048M
+ container_name: shenyu-examples-http
+ image: shenyu-examples-http:latest
+ restart: always
+ environment:
+ - shenyu.register.serverLists=http://shenyu-admin:9095
+ healthcheck:
+ test: [ "CMD", "wget", "http://shenyu-examples-http:8189/test/path/123?name=tom" ]
+ timeout: 2s
+ retries: 30
+ ports:
+ - "8189:8189"
+ depends_on:
+ shenyu-admin:
+ condition: service_healthy
+ networks:
+ - shenyu
+
+networks:
+ shenyu:
+ name: shenyu
+ driver: bridge
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/pom.xml
new file mode 100644
index 0000000..a1df94e
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/pom.xml
@@ -0,0 +1,108 @@
+<?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>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-integrated-test-agent-tracing</artifactId>
+ <version>2.4.3-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-integrated-test-agent-tracing-zipkin</artifactId>
+ <name>shenyu-integrated-test-agent-tracing-zipkin</name>
+ <url>https://shenyu.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-divide</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>shenyu-integrated-test-agent-tracing-zipkin</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/binary.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ <executions>
+ <execution>
+ <id>bin</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>it4a</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>dockerfile-maven-plugin</artifactId>
+ <version>${dockerfile-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>shenyu-integrated-test-agent-tracing-zipkin</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <repository>apache/shenyu-integrated-test-agent-tracing-zipkin</repository>
+ <tag>latest</tag>
+ <buildArgs>
+ <APP_NAME>shenyu-integrated-test-agent-tracing-zipkin</APP_NAME>
+ </buildArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>test</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>false</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/script/healthcheck.sh b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/script/healthcheck.sh
new file mode 100644
index 0000000..22a7603
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/script/healthcheck.sh
@@ -0,0 +1,36 @@
+#!/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.
+#
+
+PRGDIR=`dirname "$0"`
+for service in `grep -v -E "^$|^#" ${PRGDIR}/services.list`
+do
+ for loop in `seq 1 30`
+ do
+ status=`curl -o /dev/null -s -w %{http_code} $service`
+ echo -e "curl $service response $status"
+
+ if [ $status -eq 200 ]; then
+ break
+ fi
+
+ sleep 2
+ done
+done
+
+sleep 3
+echo -e "\n-------------------"
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/script/services.list b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/script/services.list
new file mode 100644
index 0000000..e48dc7e
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/script/services.list
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+http://localhost:9095/actuator/health
+http://localhost:8189/test/path/123?name=tom
+http://localhost:9195/actuator/health
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/assembly/binary.xml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/assembly/binary.xml
new file mode 100644
index 0000000..7f1e56b
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/assembly/binary.xml
@@ -0,0 +1,90 @@
+<!--
+ ~ 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/ASSEMBLY/2.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
+ <id>bin</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <lineEnding>unix</lineEnding>
+ <includes>
+ <include>*.xml</include>
+ </includes>
+ <outputDirectory>conf</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>*.yml</include>
+ </includes>
+ <outputDirectory>conf</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources/bin</directory>
+ <lineEnding>unix</lineEnding>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ <fileSet>
+ <outputDirectory>ext-lib</outputDirectory>
+ <excludes>
+ <exclude>**/*</exclude>
+ </excludes>
+ </fileSet>
+
+ <!-- agent -->
+ <fileSet>
+ <directory>${project.basedir}/../../../../shenyu-agent/target</directory>
+ <includes>
+ <include>shenyu-agent.jar</include>
+ </includes>
+ <outputDirectory>agent</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/../../../../shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-tracing/target/plugins</directory>
+ <outputDirectory>agent/plugins</outputDirectory>
+ <includes>
+ <include>shenyu-agent-plugin-tracing-common-*.jar</include>
+ <include>shenyu-agent-plugin-tracing-zipkin-*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources/conf</directory>
+ <includes>
+ <include>*.yaml</include>
+ </includes>
+ <outputDirectory>agent/conf</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <fileMode>0644</fileMode>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/java/org/apache/shenyu/integrated/test/agent/zipkin/ZipkinIntegratedBootstrap.java b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/java/org/apache/shenyu/integrated/test/agent/zipkin/ZipkinIntegratedBootstrap.java
new file mode 100644
index 0000000..db6e47b
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/java/org/apache/shenyu/integrated/test/agent/zipkin/ZipkinIntegratedBootstrap.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 org.apache.shenyu.integrated.test.agent.zipkin;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * The zipkin plugin of agent integrated bootstrap.
+ */
+@SpringBootApplication
+public class ZipkinIntegratedBootstrap {
+
+ /**
+ * main method of App.
+ *
+ * @param args args
+ */
+ public static void main(final String[] args) {
+ SpringApplication.run(ZipkinIntegratedBootstrap.class);
+ }
+}
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/application.yml
new file mode 100644
index 0000000..840609d
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/application.yml
@@ -0,0 +1,52 @@
+# 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
+ address: 0.0.0.0
+
+spring:
+ main:
+ allow-bean-definition-overriding: true
+ application:
+ name: shenyu-bootstrap
+
+management:
+ health:
+ defaults:
+ enabled: false
+
+shenyu:
+ switchConfig:
+ local: true
+ cross:
+ enabled: true
+ sync:
+ websocket:
+ urls: ws://shenyu-admin:9095/websocket
+ exclude:
+ enabled: true
+ paths:
+ - /favicon.ico
+ - /actuator/health
+
+logging:
+ level:
+ root: info
+ org.springframework.boot: info
+ org.apache.ibatis: info
+ org.apache.shenyu.bonuspoint: info
+ org.apache.shenyu.lottery: info
+ org.apache.shenyu: info
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/bin/start.sh b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/bin/start.sh
new file mode 100644
index 0000000..60cce96
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/bin/start.sh
@@ -0,0 +1,65 @@
+#!/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.
+#
+
+SERVER_NAME=ShenYu-Bootstrap
+
+cd `dirname $0`
+cd ..
+DEPLOY_DIR=`pwd`
+
+LOGS_DIR=${DEPLOY_DIR}/logs
+if [ ! -d ${LOGS_DIR} ]; then
+ mkdir ${LOGS_DIR}
+fi
+
+LOG_FILES=${LOGS_DIR}/shenyu-bootstrap.log
+EXT_LIB=${DEPLOY_DIR}/ext-lib
+
+PIDS=`ps -ef | grep "$DEPLOY_DIR" | grep -v grep | pgrep -f java`
+if [ -n "$PIDS" ]; then
+ echo "ERROR: The $SERVER_NAME already started!"
+ echo "PID: $PIDS"
+ exit 1
+fi
+
+CLASS_PATH=.:${DEPLOY_DIR}/conf:${DEPLOY_DIR}/lib/*:${EXT_LIB}/*
+JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss512k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m"
+
+version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}'`
+echo "current jdk version:${version}"
+if [[ "$version" =~ "1.8" ]];then
+JAVA_OPTS="${JAVA_OPTS} -XX:+UseFastAccessorMethods -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
+elif [[ "$version" =~ "11" ]];then
+JAVA_OPTS="${JAVA_OPTS}"
+elif [[ "$version" =~ "17" ]];then
+JAVA_OPTS="${JAVA_OPTS}"
+fi
+
+MAIN_CLASS=org.apache.shenyu.integrated.test.agent.zipkin.ZipkinIntegratedBootstrap
+
+if [[ "$1" == "agent" ]]; then
+ echo "Starting the $SERVER_NAME with shenyu-agent ..."
+ SHENYU_AGENT=${DEPLOY_DIR}/agent/shenyu-agent.jar
+ nohup java ${JAVA_OPTS} -javaagent:${SHENYU_AGENT} -classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${LOG_FILES} 2>&1 &
+else
+ echo "Starting the $SERVER_NAME ..."
+ nohup java ${JAVA_OPTS} -classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${LOG_FILES} 2>&1 &
+fi
+
+sleep 1
+echo "Please check the log files: $LOG_FILES"
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/bin/stop.sh b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/bin/stop.sh
new file mode 100644
index 0000000..73599d2
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/bin/stop.sh
@@ -0,0 +1,51 @@
+#!/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.
+#
+
+SERVER_NAME=ShenYu-Bootstrap
+
+cd `dirname $0`
+cd ..
+DEPLOY_DIR=`pwd`
+
+PIDS=`ps -ef | grep "$DEPLOY_DIR" | grep -v grep | pgrep -f java`
+if [ -z "$PIDS" ]; then
+ echo "ERROR: The $SERVER_NAME does not started!"
+ exit 1
+fi
+
+echo -e "Stopping the $SERVER_NAME ...\c"
+for PID in ${PIDS} ; do
+ kill ${PID} > /dev/null 2>&1
+done
+
+COUNT=0
+while [ ${COUNT} -lt 1 ]; do
+ echo -e ".\c"
+ sleep 1
+ COUNT=1
+ for PID in ${PIDS} ; do
+ PID_EXIST=`ps -f -p ${PID} | grep java`
+ if [ -n "$PID_EXIST" ]; then
+ COUNT=0
+ break
+ fi
+ done
+done
+
+echo "OK!"
+echo "PID: $PIDS"
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/logback.xml
similarity index 54%
copy from shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/pom.xml
copy to shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/logback.xml
index 289b7eb..41d80cd 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/pom.xml
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/logback.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
@@ -15,21 +15,19 @@
~ 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-integrated-test-agent</artifactId>
- <groupId>org.apache.shenyu</groupId>
- <version>2.4.3-SNAPSHOT</version>
- </parent>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>shenyu-integrated-test-agent-tracing</artifactId>
-
- <modules>
- <module>shenyu-integrated-test-agent-tracing-opentelemetry</module>
- </modules>
-
-</project>
+<configuration>
+ <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <logger name="org.apache.shenyu" level="info" additivity="false">
+ <appender-ref ref="console" />
+ </logger>
+
+ <root>
+ <level value="info" />
+ <appender-ref ref="console" />
+ </root>
+</configuration>
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/shenyu-agent.yaml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/shenyu-agent.yaml
new file mode 100644
index 0000000..e886c67
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/shenyu-agent.yaml
@@ -0,0 +1,44 @@
+#
+# 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.
+#
+
+appName: shenyu-agent
+supports:
+ tracing:
+ - zipkin
+
+plugins:
+ tracing:
+ jaeger:
+ host: "localhost"
+ port: 5775
+ props:
+ SERVICE_NAME: "shenyu-agent"
+ JAEGER_SAMPLER_TYPE: "const"
+ JAEGER_SAMPLER_PARAM: "1"
+ opentelemetry:
+ props:
+ otel.traces.exporter: jaeger #zipkin #otlp
+ otel.resource.attributes: "service.name=shenyu-agent"
+ otel.exporter.jaeger.endpoint: "http://shenyu-jaeger:14250/api/traces"
+ zipkin:
+ host: "shenyu-zipkin"
+ port: 9411
+ props:
+ SERVICE_NAME: "shenyu-agent"
+ URL_VERSION: "/api/v2/spans"
+ SAMPLER_TYPE: "const"
+ SAMPLER_PARAM: "1"
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/tracing-point.yaml b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/tracing-point.yaml
new file mode 100644
index 0000000..dc307b5
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/main/resources/conf/tracing-point.yaml
@@ -0,0 +1,221 @@
+#
+# 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.
+#
+
+pointCuts:
+ - targetClass: org.apache.shenyu.plugin.global.GlobalPlugin
+ points:
+ - type: instanceMethod
+ name: execute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinGlobalPluginHandler
+ - targetClass: org.apache.shenyu.plugin.context.path.ContextPathPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.divide.DividePlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.alibaba.dubbo.AlibabaDubboPlugin
+ points:
+ - type: instanceMethod
+ name: doDubboInvoker
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.apache.dubbo.ApacheDubboPlugin
+ points:
+ - type: instanceMethod
+ name: doDubboInvoker
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.general.context.GeneralContextPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.grpc.GrpcPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.hystrix.HystrixPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.jwt.JwtPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.logging.LoggingPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.modify.response.ModifyResponsePlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.monitor.MonitorPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.motan.MotanPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.oauth2.OAuth2Plugin
+ points:
+ - type: instanceMethod
+ name: execute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.param.mapping.ParamMappingPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.redirect.RedirectPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.request.RequestPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.resilience4j.Resilience4JPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.response.ResponsePlugin
+ points:
+ - type: instanceMethod
+ name: execute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.rewrite.RewritePlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.sentinel.SentinelPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.sign.SignPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.sofa.SofaPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.springcloud.SpringCloudPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.tars.TarsPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.uri.URIPlugin
+ points:
+ - type: instanceMethod
+ name: execute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.waf.WafPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
+ - targetClass: org.apache.shenyu.plugin.websocket.WebSocketPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ zipkin:
+ - org.apache.shenyu.agent.plugin.tracing.zipkin.handler.ZipkinPluginCommonHandler
\ No newline at end of file
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/test/java/org/apache/shenyu/integrated/test/agent/zipkin/ZipkinPluginTest.java b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/test/java/org/apache/shenyu/integrated/test/agent/zipkin/ZipkinPluginTest.java
new file mode 100644
index 0000000..cd36a83
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/test/java/org/apache/shenyu/integrated/test/agent/zipkin/ZipkinPluginTest.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.agent.zipkin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shenyu.integrated.test.agent.zipkin.result.ZipkinSpan;
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.dto.OrderDTO;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonParser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Test for tracing zipkin plugin.
+ */
+public class ZipkinPluginTest extends AbstractPluginDataInit {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ZipkinPluginTest.class);
+
+ private static final String ZIPKIN_HTTP_SERVER = "http://localhost:9411/api/v2/traces?serviceName=shenyu-agent";
+
+ private static final Gson GSON = new Gson();
+
+ @BeforeClass
+ public static void setup() throws IOException, InterruptedException {
+ OrderDTO user = new OrderDTO("123", "Tom");
+ user = HttpHelper.INSTANCE.postGateway("/http/order/save", user, OrderDTO.class);
+ assertEquals("hello world save order", user.getName());
+ // Sleep for Zipkin to react
+ Thread.sleep(5000);
+ }
+
+ @Test
+ public void testTraces() throws IOException {
+ String tracesResponse = Objects.requireNonNull(HttpHelper.INSTANCE.getHttpService(ZIPKIN_HTTP_SERVER, null).body()).string();
+ LOG.info("testTraces get response from jaeger: ({})", tracesResponse);
+ JsonArray array = JsonParser.parseString(tracesResponse)
+ .getAsJsonArray()
+ .get(0)
+ .getAsJsonArray();
+ List<ZipkinSpan> spanList = new ArrayList<>();
+ array.forEach(element -> spanList.add(GSON.fromJson(element, ZipkinSpan.class)));
+ assertTrue(CollectionUtils.isNotEmpty(spanList));
+ spanList.forEach(this::assertSpan);
+ }
+
+ private void assertSpan(final ZipkinSpan span) {
+ assertNotNull(span);
+ assertNotNull(span.getTraceId());
+ assertNotNull(span.getId());
+ assertNotNull(span.getTimestamp());
+ assertNotNull(span.getDuration());
+ }
+
+}
diff --git a/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/test/java/org/apache/shenyu/integrated/test/agent/zipkin/result/ZipkinSpan.java b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/test/java/org/apache/shenyu/integrated/test/agent/zipkin/result/ZipkinSpan.java
new file mode 100644
index 0000000..dc6772e
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-agent/shenyu-integrated-test-agent-tracing/shenyu-integrated-test-agent-tracing-zipkin/src/test/java/org/apache/shenyu/integrated/test/agent/zipkin/result/ZipkinSpan.java
@@ -0,0 +1,166 @@
+/*
+ * 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.shenyu.integrated.test.agent.zipkin.result;
+
+import java.util.Map;
+
+/**
+ * The type zipkin span.
+ */
+public class ZipkinSpan {
+
+ private String traceId;
+
+ private String id;
+
+ private String name;
+
+ private Long timestamp;
+
+ private Long duration;
+
+ private Map<String, String> localEndpoint;
+
+ private Map<String, String> tags;
+
+ /**
+ * get trace id.
+ *
+ * @return trace id
+ */
+ public String getTraceId() {
+ return traceId;
+ }
+
+ /**
+ * set trace id.
+ *
+ * @param traceId the trace id
+ */
+ public void setTraceId(final String traceId) {
+ this.traceId = traceId;
+ }
+
+ /**
+ * 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 the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * set name.
+ *
+ * @param name name
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * get time stamp.
+ *
+ * @return timestamp
+ */
+ public Long getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * set timestamp.
+ *
+ * @param timestamp timestamp
+ */
+ public void setTimestamp(final Long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * get duration.
+ *
+ * @return duration
+ */
+ public Long getDuration() {
+ return duration;
+ }
+
+ /**
+ * set duration.
+ *
+ * @param duration duration
+ */
+ public void setDuration(final Long duration) {
+ this.duration = duration;
+ }
+
+ /**
+ * get local end point.
+ *
+ * @return local end point
+ */
+ public Map<String, String> getLocalEndpoint() {
+ return localEndpoint;
+ }
+
+ /**
+ * set local end point.
+ *
+ * @param localEndpoint local end point
+ */
+ public void setLocalEndpoint(final Map<String, String> localEndpoint) {
+ this.localEndpoint = localEndpoint;
+ }
+
+ /**
+ * get tags.
+ *
+ * @return tags
+ */
+ public Map<String, String> getTags() {
+ return tags;
+ }
+
+ /**
+ * set tags.
+ *
+ * @param tags tags
+ */
+ public void setTags(final Map<String, String> tags) {
+ this.tags = tags;
+ }
+}