This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 48e075c Add integration test for opentelemetry plugin (#11273)
48e075c is described below
commit 48e075c0ffec921efd358c4d2bf57e038dbdfb2f
Author: Kunshuai Zhu <[email protected]>
AuthorDate: Tue Jul 13 14:45:59 2021 +0800
Add integration test for opentelemetry plugin (#11273)
* Add integration test for opentelemetry plugin
* Add action workflow for integration of ot
---
.github/workflows/it.yml | 21 +++
.../pom.xml | 1 +
.../agent/test/common/util/OkHttpUtils.java | 16 +-
.../test/resources/docker/proxy/conf/agent.yaml | 5 +
.../Dockerfile} | 40 +----
.../pom.xml | 192 +++++++++++++++++++++
.../src/test/assembly/bin/start.sh | 71 ++++++++
.../src/test/assembly/bin/stop.sh} | 64 +++----
...ngsphere-proxy-agent-opentelemetry-assembly.xml | 58 +++++++
.../test/opentelemetry/OpenTelemetryPluginIT.java | 141 +++++++++++++++
.../test/opentelemetry/result/TracingResult.java | 40 +++++
.../src/test/resources/docker/docker-compose.yml | 58 +++++++
.../test/resources/docker/proxy/conf/agent.yaml | 6 +
.../resources/docker/proxy/conf/config-db.yaml | 74 ++++++++
.../test/resources/docker/proxy/conf/logback.xml | 33 ++++
.../test/resources/docker/proxy/conf/server.yaml} | 45 ++---
.../src/test/resources/env/engine-env.properties | 29 ++++
.../src/test/resources/env/mysql/init.sql | 34 ++++
18 files changed, 832 insertions(+), 96 deletions(-)
diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml
index 54dee41..4a1bafa 100644
--- a/.github/workflows/it.yml
+++ b/.github/workflows/it.yml
@@ -77,3 +77,24 @@ jobs:
run: ./mvnw -B clean install -Dmaven.javadoc.skip=true -Drat.skip=true
-Djacoco.skip=true -DskipITs -DskipTests
- name: Run Integration Test
run: ./mvnw -B clean install -f
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/pom.xml
-Pit.env.metrics
+
+ mysql-proxy-agent-tracing-opentelemetry:
+ name: MySQL-Proxy with Agent Tracing OpenTelemetry
+ runs-on: ubuntu-latest
+ steps:
+ - name: Cache Maven Repos
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - uses: actions/checkout@v2
+ - name: Set up JDK 8
+ uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - name: Build Project
+ run: ./mvnw -B clean install -Dmaven.javadoc.skip=true -Drat.skip=true
-Djacoco.skip=true -DskipITs -DskipTests
+ - name: Run Integration Test
+ run: ./mvnw -B clean install -f
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml
-Pit.env.opentelemetry
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/pom.xml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/pom.xml
index 6f9951a..bedb32d 100644
---
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/pom.xml
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/pom.xml
@@ -34,6 +34,7 @@
<module>shardingsphere-integration-agent-test-common</module>
<module>shardingsphere-integration-agent-test-zipkin</module>
<module>shardingsphere-integration-agent-test-jaeger</module>
+ <module>shardingsphere-integration-agent-test-opentelemetry</module>
</modules>
</project>
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-common/src/test/java/org/apache/shardingsphere/integration/agent/test/common/util/OkHttpUtils.java
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-common/src/test/java/org/apache/shardingsphere/integration/agent/test/common/util/OkHttpUtils.java
index 4d743a8..9ebfc20 100644
---
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-common/src/test/java/org/apache/shardingsphere/integration/agent/test/common/util/OkHttpUtils.java
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-common/src/test/java/org/apache/shardingsphere/integration/agent/test/common/util/OkHttpUtils.java
@@ -56,7 +56,7 @@ public final class OkHttpUtils {
}
/**
- * Get request.
+ * Get response json and transform to class bean.
*
* @param <T> type parameter
* @param url url
@@ -65,10 +65,20 @@ public final class OkHttpUtils {
* @throws IOException the IOException
*/
public <T> T get(final String url, final Class<T> clazz) throws
IOException {
+ return GSON.fromJson(get(url), clazz);
+ }
+
+ /**
+ * Get response json.
+ *
+ * @param url url
+ * @return response json
+ * @throws IOException the IOException
+ */
+ public String get(final String url) throws IOException {
Request request = new Request.Builder().url(url).build();
Response response = client.newCall(request).execute();
assertNotNull(response.body());
- String result = response.body().string();
- return GSON.fromJson(result, clazz);
+ return response.body().string();
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
index 766de2c..6cecfeb 100644
---
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
@@ -20,6 +20,7 @@ ignoredPluginNames:
- Jaeger
- Opentracing
- Zipkin
+ - OpenTelemetry
plugins:
prometheus:
@@ -44,6 +45,10 @@ plugins:
Opentracing:
props:
OPENTRACING_TRACER_CLASS_NAME:
"org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer"
+ OpenTelemetry:
+ props:
+ otel.resource.attributes: "service.name=shardingsphere-agent"
+ otel.traces.exporter: "zipkin"
Logging:
props:
LEVEL: "INFO"
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/Dockerfile
similarity index 51%
copy from
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
copy to
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/Dockerfile
index 766de2c..09cbc02 100644
---
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/Dockerfile
@@ -15,35 +15,13 @@
# limitations under the License.
#
-applicationName: shardingsphere-agent
-ignoredPluginNames:
- - Jaeger
- - Opentracing
- - Zipkin
+FROM openjdk:8-jdk-alpine
-plugins:
- prometheus:
- port: 18090
- props:
- JVM_INFORMATION_COLLECTOR_ENABLED : "true"
- Jaeger:
- host: "localhost"
- port: 5775
- props:
- SERVICE_NAME: "shardingsphere-agent"
- JAEGER_SAMPLER_TYPE: "const"
- JAEGER_SAMPLER_PARAM: "1"
- JAEGER_REPORTER_LOG_SPANS: "true"
- JAEGER_REPORTER_FLUSH_INTERVAL: "1"
- Zipkin:
- host: "localhost"
- port: 9411
- props:
- SERVICE_NAME: "shardingsphere-agent"
- URL_VERSION: "/api/v2/spans"
- Opentracing:
- props:
- OPENTRACING_TRACER_CLASS_NAME:
"org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer"
- Logging:
- props:
- LEVEL: "INFO"
+ARG APP_NAME
+ENV WAIT_VERSION 2.7.2
+
+ADD target/${APP_NAME}.tar.gz /opt
+ADD
https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait
/wait
+RUN chmod +x /wait
+RUN mv /opt/${APP_NAME} /opt/shardingsphere-proxy-agent-tracing-opentelemetry
+ENTRYPOINT /wait &&
/opt/shardingsphere-proxy-agent-tracing-opentelemetry/bin/start.sh && tail -f
/opt/shardingsphere-proxy-agent-tracing-opentelemetry/logs/stdout.log
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml
new file mode 100644
index 0000000..1035c38
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/pom.xml
@@ -0,0 +1,192 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-integration-agent-test-plugins</artifactId>
+ <version>5.0.0-RC1-SNAPSHOT</version>
+ </parent>
+
<artifactId>shardingsphere-integration-agent-test-opentelemetry</artifactId>
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ <gson.version>2.8.0</gson.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+
<artifactId>shardingsphere-integration-agent-test-common</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-jdbc-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-proxy-bootstrap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>${gson.version}</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>it.env.opentelemetry</id>
+ <properties>
+ <it.env>opentelemetry</it.env>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+
<descriptor>src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>dockerfile-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>shardingsphere-proxy-bin</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+
<repository>apache/shardingsphere-proxy-agent-tracing-opentelemetry-test</repository>
+ <tag>${project.version}</tag>
+ <tag>latest</tag>
+ <buildArgs>
+ <APP_NAME>${project.build.finalName}</APP_NAME>
+ </buildArgs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.dkanejs.maven.plugins</groupId>
+ <artifactId>docker-compose-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>agent-opentelemetry-up</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>up</goal>
+ </goals>
+ <configuration>
+
<composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+ <detachedMode>true</detachedMode>
+ </configuration>
+ </execution>
+ <execution>
+ <id>agent-opentelemetry-down</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>down</goal>
+ </goals>
+ <configuration>
+
<composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+ <removeVolumes>true</removeVolumes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+
<outputDirectory>target/test-classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/bin/start.sh
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/bin/start.sh
new file mode 100644
index 0000000..aaa4da4
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/bin/start.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# 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=ShardingSphere-Proxy-Tracing-OpenTelemetry
+
+cd `dirname $0`
+cd ..
+DEPLOY_DIR=`pwd`
+
+LOGS_DIR=${DEPLOY_DIR}/logs
+if [ ! -d ${LOGS_DIR} ]; then
+ mkdir ${LOGS_DIR}
+fi
+
+STDOUT_FILE=${LOGS_DIR}/stdout.log
+EXT_LIB=${DEPLOY_DIR}/ext-lib
+
+CLASS_PATH=.:${DEPLOY_DIR}/lib/*:${EXT_LIB}/*
+
+JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=3308"
+
+JAVA_MEM_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled
-XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
+
+MAIN_CLASS=org.apache.shardingsphere.proxy.Bootstrap
+
+print_usage() {
+ echo "usage: start.sh [port] [config_dir]"
+ echo " port: proxy listen port, default is 3307"
+ echo " config_dir: proxy config directory, default is conf"
+ exit 0
+}
+
+if [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
+ print_usage
+fi
+
+echo "Starting the $SERVER_NAME ..."
+
+if [ $# == 1 ]; then
+ MAIN_CLASS=${MAIN_CLASS}" "$1
+ echo "The port is $1"
+ CLASS_PATH=${DEPLOY_DIR}/conf:${CLASS_PATH}
+fi
+
+if [ $# == 2 ]; then
+ MAIN_CLASS=${MAIN_CLASS}" "$1" "$2
+ echo "The port is $1"
+ echo "The configuration path is $DEPLOY_DIR/$2"
+ CLASS_PATH=${DEPLOY_DIR}/$2:${CLASS_PATH}
+fi
+
+echo "The classpath is ${CLASS_PATH}"
+
+nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS}
-javaagent:/opt/shardingsphere-proxy-agent-tracing-opentelemetry/shardingsphere-agent.jar
-classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 &
+sleep 1
+echo "Please check the STDOUT file: $STDOUT_FILE"
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/bin/stop.sh
similarity index 51%
copy from
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
copy to
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/bin/stop.sh
index 766de2c..da8909e 100644
---
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/bin/stop.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -15,35 +16,36 @@
# limitations under the License.
#
-applicationName: shardingsphere-agent
-ignoredPluginNames:
- - Jaeger
- - Opentracing
- - Zipkin
+SERVER_NAME=ShardingSphere-Proxy
-plugins:
- prometheus:
- port: 18090
- props:
- JVM_INFORMATION_COLLECTOR_ENABLED : "true"
- Jaeger:
- host: "localhost"
- port: 5775
- props:
- SERVICE_NAME: "shardingsphere-agent"
- JAEGER_SAMPLER_TYPE: "const"
- JAEGER_SAMPLER_PARAM: "1"
- JAEGER_REPORTER_LOG_SPANS: "true"
- JAEGER_REPORTER_FLUSH_INTERVAL: "1"
- Zipkin:
- host: "localhost"
- port: 9411
- props:
- SERVICE_NAME: "shardingsphere-agent"
- URL_VERSION: "/api/v2/spans"
- Opentracing:
- props:
- OPENTRACING_TRACER_CLASS_NAME:
"org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer"
- Logging:
- props:
- LEVEL: "INFO"
+cd `dirname $0`
+cd ..
+DEPLOY_DIR=`pwd`
+
+PIDS=`ps -ef | grep java | grep "$DEPLOY_DIR" | grep -v grep |awk '{print $2}'`
+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/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
new file mode 100644
index 0000000..9d04941
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
@@ -0,0 +1,58 @@
+<!--
+ ~ 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.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0
http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+ <id>shardingsphere-proxy-bin</id>
+ <formats>
+ <format>tar.gz</format>
+ </formats>
+ <includeBaseDirectory>true</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+
<directory>${project.basedir}/../../../../shardingsphere-agent/shardingsphere-agent-distribution/target/shardingsphere-agent/plugins</directory>
+ <outputDirectory>./plugins</outputDirectory>
+ <includes>
+
<include>shardingsphere-agent-tracing-opentelemetry-*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+
<directory>${project.basedir}/../../../../shardingsphere-agent/shardingsphere-agent-bootstrap/target</directory>
+ <outputDirectory>./</outputDirectory>
+ <includes>
+ <include>shardingsphere-agent.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/test/assembly/bin</directory>
+ <lineEnding>unix</lineEnding>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <fileMode>0644</fileMode>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/java/org/apache/shardingsphere/integration/agent/test/opentelemetry/OpenTelemetryPluginIT.java
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/java/org/apache/shardingsphere/integration/agent/test
[...]
new file mode 100644
index 0000000..72d6ab0
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/java/org/apache/shardingsphere/integration/agent/test/opentelemetry/OpenTelemetryPluginIT.java
@@ -0,0 +1,141 @@
+/*
+ * 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.shardingsphere.integration.agent.test.opentelemetry;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonParser;
+import lombok.extern.slf4j.Slf4j;
+import
org.apache.shardingsphere.integration.agent.test.common.entity.OrderEntity;
+import
org.apache.shardingsphere.integration.agent.test.common.env.IntegrationTestEnvironment;
+import
org.apache.shardingsphere.integration.agent.test.common.util.JDBCAgentTestUtils;
+import
org.apache.shardingsphere.integration.agent.test.common.util.OkHttpUtils;
+import
org.apache.shardingsphere.integration.agent.test.opentelemetry.result.TracingResult;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+@Slf4j
+public final class OpenTelemetryPluginIT {
+
+ private static final String SS_ROOTINVOKE = "/shardingsphere/rootinvoke/";
+
+ private static final String SS_PARSESQL = "/shardingsphere/parsesql/";
+
+ private static final String SS_EXECUTESQL = "/shardingsphere/executesql/";
+
+ @Test
+ public void assertProxyWithAgent() {
+ if (IntegrationTestEnvironment.getInstance().isEnvironmentPrepared()) {
+ DataSource dataSource =
IntegrationTestEnvironment.getInstance().getDataSource();
+ List<Long> results = new ArrayList<>(10);
+ for (int i = 1; i <= 10; i++) {
+ OrderEntity orderEntity = new OrderEntity(i, i, "INSERT_TEST");
+ JDBCAgentTestUtils.insertOrder(orderEntity, dataSource);
+ results.add(orderEntity.getOrderId());
+ }
+ OrderEntity orderEntity = new OrderEntity(1000, 1000, "ROLL_BACK");
+ JDBCAgentTestUtils.insertOrderRollback(orderEntity, dataSource);
+ JDBCAgentTestUtils.updateOrderStatus(orderEntity, dataSource);
+ JDBCAgentTestUtils.selectAllOrders(dataSource);
+ for (Long each : results) {
+ JDBCAgentTestUtils.deleteOrderByOrderId(each, dataSource);
+ }
+ Properties engineEnvProps =
IntegrationTestEnvironment.getInstance().getEngineEnvProps();
+ try {
+
Thread.sleep(Long.parseLong(engineEnvProps.getProperty("opentelemetry.waitMs",
"60000")));
+ } catch (final InterruptedException ignore) {
+ }
+ String url =
engineEnvProps.getProperty("opentelemetry.zipkin.url") +
engineEnvProps.getProperty("opentelemetry.servername");
+ String response = null;
+ try {
+ response = OkHttpUtils.getInstance().get(url);
+ } catch (final IOException ex) {
+ log.info("http get zipkin is error :", ex);
+ }
+ assertNotNull(response);
+ JsonArray array = new
JsonParser().parse(response).getAsJsonArray().get(0).getAsJsonArray();
+ Gson gson = new Gson();
+ ArrayList<TracingResult> traces = new ArrayList<>();
+ array.forEach(element -> traces.add(gson.fromJson(element,
TracingResult.class)));
+ assertTraces(traces);
+ }
+ }
+
+ private void assertTraces(final ArrayList<TracingResult> traces) {
+ traces.forEach(tracingResult -> {
+ assertNotNull(tracingResult.getTraceId());
+ assertNotNull(tracingResult.getId());
+ String name = tracingResult.getName();
+ assertNotNull(name);
+ assertNotNull(tracingResult.getTimestamp());
+ assertNotNull(tracingResult.getDuration());
+ Map<String, String> localEndPoint =
tracingResult.getLocalEndpoint();
+ assertNotNull(localEndPoint);
+ assertThat(localEndPoint.get("serviceName"),
is("shardingsphere-agent"));
+ assertNotNull(localEndPoint.get("ipv4"));
+ Map<String, String> tags = tracingResult.getTags();
+ switch (name) {
+ case SS_ROOTINVOKE:
+ assertRootInvokeTags(tags);
+ break;
+ case SS_PARSESQL:
+ assertParseSqlTags(tags);
+ break;
+ case SS_EXECUTESQL:
+ assertExecuteSqlTags(tags);
+ break;
+ default:
+ fail();
+ }
+ });
+ }
+
+ private void assertRootInvokeTags(final Map<String, String> tags) {
+ assertThat(tags.get("component"), is("ShardingSphere"));
+ assertThat(tags.get("otel.library.name"), is("shardingsphere-agent"));
+ }
+
+ private void assertParseSqlTags(final Map<String, String> tags) {
+ assertThat(tags.get("component"), is("ShardingSphere"));
+ assertNotNull(tags.get("db.statement"));
+ assertThat(tags.get("db.type"), is("shardingsphere-proxy"));
+ assertThat(tags.get("otel.library.name"), is("shardingsphere-agent"));
+ }
+
+ private void assertExecuteSqlTags(final Map<String, String> tags) {
+ assertThat(tags.get("component"), is("ShardingSphere"));
+ assertNotNull(tags.get("db.bind_vars"));
+ assertNotNull(tags.get("db.instance"));
+ assertNotNull(tags.get("db.statement"));
+ assertThat(tags.get("db.type"), is("shardingsphere-proxy"));
+ assertThat(tags.get("otel.library.name"), is("shardingsphere-agent"));
+ assertNotNull(tags.get("peer.hostname"));
+ assertNotNull(tags.get("peer.port"));
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/java/org/apache/shardingsphere/integration/agent/test/opentelemetry/result/TracingResult.java
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/java/org/apache/shardingsphere/integration/agent/test/
[...]
new file mode 100644
index 0000000..2641420
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/java/org/apache/shardingsphere/integration/agent/test/opentelemetry/result/TracingResult.java
@@ -0,0 +1,40 @@
+/*
+ * 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.shardingsphere.integration.agent.test.opentelemetry.result;
+
+import lombok.Data;
+
+import java.util.Map;
+
+@Data
+public class TracingResult {
+
+ 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;
+}
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/docker-compose.yml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/docker-compose.yml
new file mode 100644
index 0000000..670498d
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/docker-compose.yml
@@ -0,0 +1,58 @@
+#
+# 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: "2.1"
+
+services:
+ mysql:
+ image: "mysql/mysql-server:5.7"
+ container_name: agent-tracing-opentelemetry-mysql
+ command: ['--sql_mode=',
'--default-authentication-plugin=mysql_native_password']
+ volumes:
+ - ../env/mysql:/docker-entrypoint-initdb.d/
+ ports:
+ - "43060:3306"
+ environment:
+ - LANG=C.UTF-8
+
+ zipkin:
+ image: "openzipkin/zipkin:latest"
+ container_name: agent-opentelemetry-zipkin
+ restart: always
+ ports:
+ - "19411:9411"
+
+ shardingsphere-proxy-agent-tracing:
+ image: apache/shardingsphere-proxy-agent-tracing-opentelemetry-test
+ container_name: shardingsphere-proxy-agent-tracing-opentelemetry
+ ports:
+ - "43070:3307"
+ - "43080:3308"
+ - "18090:18090"
+ links:
+ - "mysql:mysql.agent.tracing.opentelemetry.host"
+ - "zipkin:zipkin.agent.tracing.opentelemetry.host"
+ volumes:
+ - ./proxy/conf:/opt/shardingsphere-proxy-agent-tracing-opentelemetry/conf
+ depends_on:
+ - mysql
+ - zipkin
+ environment:
+ - WAIT_HOSTS=mysql:3306
+ - WAIT_HOSTS_TIMEOUT=300
+ - WAIT_SLEEP_INTERVAL=5
+ - WAIT_HOST_CONNECT_TIMEOUT=30
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/agent.yaml
similarity index 85%
copy from
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
copy to
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/agent.yaml
index 766de2c..4605481 100644
---
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/agent.yaml
@@ -20,6 +20,7 @@ ignoredPluginNames:
- Jaeger
- Opentracing
- Zipkin
+ - Prometheus
plugins:
prometheus:
@@ -44,6 +45,11 @@ plugins:
Opentracing:
props:
OPENTRACING_TRACER_CLASS_NAME:
"org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer"
+ OpenTelemetry:
+ props:
+ otel.resource.attributes: "service.name=shardingsphere-agent"
+ otel.traces.exporter: "zipkin"
+ otel.exporter.zipkin.endpoint:
"http://zipkin.agent.tracing.opentelemetry.host:9411/api/v2/spans"
Logging:
props:
LEVEL: "INFO"
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/config-db.yaml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/config-db.yaml
new file mode 100644
index 0000000..8d46091
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/config-db.yaml
@@ -0,0 +1,74 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+schemaName: agent-tracing-opentelemetry-db
+
+dataSources:
+ ds_0:
+ url:
jdbc:mysql://mysql.agent.tracing.opentelemetry.host:3306/agent_opentelemetry_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ username: root
+ password:
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 10
+ minPoolSize: 2
+ maintenanceIntervalMilliseconds: 30000
+ ds_1:
+ url:
jdbc:mysql://mysql.agent.tracing.opentelemetry.host:3306/agent_opentelemetry_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ username: root
+ password:
+ connectionTimeoutMilliseconds: 30000
+ idleTimeoutMilliseconds: 60000
+ maxLifetimeMilliseconds: 1800000
+ maxPoolSize: 10
+ minPoolSize: 2
+ maintenanceIntervalMilliseconds: 30000
+
+rules:
+ - !SHARDING
+ tables:
+ t_order:
+ actualDataNodes: ds_${0..1}.t_order_${0..1}
+ tableStrategy:
+ standard:
+ shardingColumn: order_id
+ shardingAlgorithmName: t_order_inline
+ keyGenerateStrategy:
+ column: order_id
+ keyGeneratorName: snowflake
+ defaultDatabaseStrategy:
+ standard:
+ shardingColumn: user_id
+ shardingAlgorithmName: database_inline
+ defaultTableStrategy:
+ none:
+ shardingAlgorithms:
+ database_inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_${user_id % 2}
+ t_order_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_order_${order_id % 2}
+
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/logback.xml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/logback.xml
new file mode 100644
index 0000000..1494746
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/logback.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration>
+ <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.shardingsphere" level="info" additivity="false">
+ <appender-ref ref="console" />
+ </logger>
+
+ <root>
+ <level value="info" />
+ <appender-ref ref="console" />
+ </root>
+</configuration>
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/server.yaml
similarity index 51%
copy from
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
copy to
shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/server.yaml
index 766de2c..0e749cd 100644
---
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-metrics/src/test/resources/docker/proxy/conf/agent.yaml
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/docker/proxy/conf/server.yaml
@@ -15,35 +15,18 @@
# limitations under the License.
#
-applicationName: shardingsphere-agent
-ignoredPluginNames:
- - Jaeger
- - Opentracing
- - Zipkin
+rules:
+ - !AUTHORITY
+ users:
+ - root@:root
+ provider:
+ type: NATIVE
-plugins:
- prometheus:
- port: 18090
- props:
- JVM_INFORMATION_COLLECTOR_ENABLED : "true"
- Jaeger:
- host: "localhost"
- port: 5775
- props:
- SERVICE_NAME: "shardingsphere-agent"
- JAEGER_SAMPLER_TYPE: "const"
- JAEGER_SAMPLER_PARAM: "1"
- JAEGER_REPORTER_LOG_SPANS: "true"
- JAEGER_REPORTER_FLUSH_INTERVAL: "1"
- Zipkin:
- host: "localhost"
- port: 9411
- props:
- SERVICE_NAME: "shardingsphere-agent"
- URL_VERSION: "/api/v2/spans"
- Opentracing:
- props:
- OPENTRACING_TRACER_CLASS_NAME:
"org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer"
- Logging:
- props:
- LEVEL: "INFO"
+props:
+ max-connections-size-per-query: 1
+ executor-size: 16 # Infinite by default.
+ proxy-frontend-flush-threshold: 128 # The default value is 128.
+ proxy-transaction-type: LOCAL
+ proxy-opentracing-enabled: false
+ proxy-hint-enabled: false
+ sql-show: true
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/env/engine-env.properties
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/env/engine-env.properties
new file mode 100644
index 0000000..12fe318
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/env/engine-env.properties
@@ -0,0 +1,29 @@
+#
+# Licensed toc 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.
+#
+
+it.env.type=${it.env}
+it.env.value=opentelemetry
+
+proxy.url=jdbc:mysql://127.0.0.1:43070/agent-tracing-opentelemetry-db?serverTimezone=UTC&useSSL=false&useLocalSessionState=true&characterEncoding=utf-8
+proxy.username=root
+proxy.password=root
+proxy.retry=30
+proxy.waitMs=1000
+
+opentelemetry.waitMs=60000
+opentelemetry.zipkin.url=http://127.0.0.1:19411/api/v2/traces?serviceName=
+opentelemetry.servername=shardingsphere-agent
diff --git
a/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/env/mysql/init.sql
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/env/mysql/init.sql
new file mode 100644
index 0000000..523df69
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-agent-test/shardingsphere-integration-agent-test-plugins/shardingsphere-integration-agent-test-opentelemetry/src/test/resources/env/mysql/init.sql
@@ -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.
+--
+
+CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
+GRANT All privileges ON *.* TO 'root'@'%';
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS agent_opentelemetry_db_0;
+DROP DATABASE IF EXISTS agent_opentelemetry_db_1;
+
+CREATE DATABASE agent_opentelemetry_db_0;
+CREATE DATABASE agent_opentelemetry_db_1;
+
+CREATE TABLE agent_opentelemetry_db_0.t_order_0 (order_id INT NOT NULL,
user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE agent_opentelemetry_db_0.t_order_1 (order_id INT NOT NULL,
user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+
+CREATE TABLE agent_opentelemetry_db_1.t_order_0 (order_id INT NOT NULL,
user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE agent_opentelemetry_db_1.t_order_1 (order_id INT NOT NULL,
user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));