You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/09/20 07:22:04 UTC
[skywalking-java] branch main updated: Add HikariCP connection pool
plug-in. (#29)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git
The following commit(s) were added to refs/heads/main by this push:
new 3e97740 Add HikariCP connection pool plug-in. (#29)
3e97740 is described below
commit 3e97740036242cf4ee8808b737727a7093b3d31f
Author: 业余布道师 <Vi...@outlook.com>
AuthorDate: Mon Sep 20 15:21:57 2021 +0800
Add HikariCP connection pool plug-in. (#29)
---
.github/workflows/plugins-test.3.yaml | 1 +
CHANGES.md | 1 +
.../network/trace/component/ComponentsDefine.java | 2 +
.../apm-sdk-plugin/hikaricp-3.x-4.x-plugin/pom.xml | 44 +++++
.../hikaricp/PoolingCloseConnectInterceptor.java | 50 +++++
.../hikaricp/PoolingGetConnectInterceptor.java | 50 +++++
.../define/HikariDataSourceInstrumentation.java | 97 ++++++++++
.../HikariProxyConnectionInstrumentation.java | 80 ++++++++
.../src/main/resources/skywalking-plugin.def | 18 ++
apm-sniffer/apm-sdk-plugin/pom.xml | 1 +
.../setup/service-agent/java-agent/Plugin-list.md | 1 +
.../service-agent/java-agent/Supported-list.md | 1 +
.../scenarios/hikaricp-scenario/bin/startup.sh | 21 +++
.../hikaricp-scenario/config/expectedData.yaml | 205 +++++++++++++++++++++
.../scenarios/hikaricp-scenario/configuration.yml | 32 ++++
test/plugin/scenarios/hikaricp-scenario/pom.xml | 126 +++++++++++++
.../src/main/assembly/assembly.xml | 41 +++++
.../apm/testcase/hikaricp/Application.java | 34 ++++
.../apm/testcase/hikaricp/MySQLConfig.java | 57 ++++++
.../hikaricp/controller/CaseController.java | 58 ++++++
.../apm/testcase/hikaricp/service/CaseService.java | 65 +++++++
.../src/main/resources/application.yaml | 23 +++
.../src/main/resources/jdbc.properties | 18 ++
.../src/main/resources/log4j2.xml | 30 +++
.../hikaricp-scenario/support-version.list | 22 +++
25 files changed, 1078 insertions(+)
diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml
index db7f403..979946a 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -89,6 +89,7 @@ jobs:
- neo4j-4.x-scenario
- oracle-scenario
- druid-1.x-scenario
+ - hikaricp-scenario
steps:
- uses: actions/checkout@v2
with:
diff --git a/CHANGES.md b/CHANGES.md
index f2f1e2f..f39b0b9 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -20,6 +20,7 @@ Release Notes.
* Add thrift plugin support thrift TMultiplexedProcessor.
* Add benchmark result for `exception-ignore` plugin and polish plugin guide.
* Provide Alibaba Druid database connection pool plugin.
+* Provide HikariCP database connection pool plugin.
#### Documentation
diff --git a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
index 626ba2c..cc9ebd3 100755
--- a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
+++ b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
@@ -209,4 +209,6 @@ public class ComponentsDefine {
public static final OfficialComponent ALIBABA_DRUID = new OfficialComponent(115, "AlibabaDruid");
+ public static final OfficialComponent HIKARI_CP = new OfficialComponent(116, "HikariCP");
+
}
diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/pom.xml
new file mode 100644
index 0000000..ccab5f7
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>apm-sdk-plugin</artifactId>
+ <groupId>org.apache.skywalking</groupId>
+ <version>8.8.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>apm-hikaricp-3.x-4.x-plugin</artifactId>
+ <packaging>jar</packaging>
+ <name>hikaricp-3.x-4.x-plugin</name>
+
+ <properties>
+ <hikaricp.version>3.2.0</hikaricp.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ <version>${hikaricp.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingCloseConnectInterceptor.java b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingCloseConnectInterceptor.java
new file mode 100644
index 0000000..5e3fbc9
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingCloseConnectInterceptor.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.skywalking.apm.plugin.hikaricp;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * {@link PoolingCloseConnectInterceptor} intercepted the method of HikariCP closing/returning connection.
+ */
+public class PoolingCloseConnectInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
+ AbstractSpan span = ContextManager.createLocalSpan("HikariCP/Connection/" + method.getName());
+ span.setComponent(ComponentsDefine.HIKARI_CP);
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
+ ContextManager.stopSpan();
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
+ ContextManager.activeSpan().errorOccurred().log(t);
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingGetConnectInterceptor.java b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingGetConnectInterceptor.java
new file mode 100644
index 0000000..106851f
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingGetConnectInterceptor.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.skywalking.apm.plugin.hikaricp;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * {@link PoolingGetConnectInterceptor} intercepted the method of HikariCP getting connection.
+ */
+public class PoolingGetConnectInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
+ AbstractSpan span = ContextManager.createLocalSpan("HikariCP/Connection/" + method.getName());
+ span.setComponent(ComponentsDefine.HIKARI_CP);
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
+ ContextManager.stopSpan();
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
+ ContextManager.activeSpan().errorOccurred().log(t);
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/define/HikariDataSourceInstrumentation.java b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/define/HikariDataSourceInstrumentation.java
new file mode 100644
index 0000000..6273cfd
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/define/HikariDataSourceInstrumentation.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.skywalking.apm.plugin.hikaricp.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
+import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+
+/**
+ * HikariCP is a solid, high-performance, JDBC connection pool at last. Starting from Spring Boot 2.0,
+ * It is the default JDBC Connection Pool.
+ * <p>
+ * HikariDataSource provides a "one stop" solution for database connection pool solution
+ * basic requirements. HikariDataSource#getConnection() or HikariDataSource#getConnection(String, String)
+ * creates (if necessary) and return a connection.
+ */
+public class HikariDataSourceInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+ private static final String ENHANCE_CLASS = "com.zaxxer.hikari.HikariDataSource";
+ private static final String ENHANCE_METHOD = "getConnection";
+ private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.hikaricp.PoolingGetConnectInterceptor";
+
+ @Override
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
+ }
+
+ @Override
+ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription> getMethodsMatcher() {
+ return named(ENHANCE_METHOD);
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ },
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription> getMethodsMatcher() {
+ return named(ENHANCE_METHOD).and(takesArguments(String.class, String.class));
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
+ return new StaticMethodsInterceptPoint[0];
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/define/HikariProxyConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/define/HikariProxyConnectionInstrumentation.java
new file mode 100644
index 0000000..cf665d6
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/define/HikariProxyConnectionInstrumentation.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.skywalking.apm.plugin.hikaricp.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+
+/**
+ * HikariCP is a solid, high-performance, JDBC connection pool at last. Starting from Spring Boot 2.0,
+ * It is the default JDBC Connection Pool.
+ * <p>
+ * HikariCP use HikariProxyConnection which is the delegating implementation of Connection. All of
+ * the methods from the Connection interface simply check to see that the Connection is active.
+ * In parent ProxyConnection#close() close/return connection.
+ */
+public class HikariProxyConnectionInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+ private static final String ENHANCE_CLASS = "com.zaxxer.hikari.pool.ProxyConnection";
+ private static final String ENHANCE_METHOD = "close";
+ private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.hikaricp.PoolingCloseConnectInterceptor";
+
+ @Override
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
+ }
+
+ @Override
+ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[]{
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription> getMethodsMatcher() {
+ return named(ENHANCE_METHOD);
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return false;
+ }
+ }
+ };
+ }
+
+ @Override
+ public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
+ return new StaticMethodsInterceptPoint[0];
+ }
+}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 0000000..80d38e8
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/resources/skywalking-plugin.def
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+hikaricp-3.x/4.x=org.apache.skywalking.apm.plugin.hikaricp.define.HikariProxyConnectionInstrumentation
+hikaricp-3.x/4.x=org.apache.skywalking.apm.plugin.hikaricp.define.HikariDataSourceInstrumentation
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml
index 67b0860..5a302f4 100644
--- a/apm-sniffer/apm-sdk-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/pom.xml
@@ -108,6 +108,7 @@
<module>neo4j-4.x-plugin</module>
<module>shardingsphere-plugins</module>
<module>druid-1.x-plugin</module>
+ <module>hikaricp-3.x-4.x-plugin</module>
</modules>
<packaging>pom</packaging>
diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md
index 7174384..0e027ee 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -27,6 +27,7 @@
- guava-cache
- h2-1.x
- hbase-1.x/2.x
+- hikaricp-3.x/4.x
- httpasyncclient-4.x
- httpclient-3.x
- httpclient-4.x
diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md
index 27e4270..bc4df71 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -123,6 +123,7 @@ metrics based on the tracing data.
* Pool
* [Apache Commons DBCP](https://github.com/apache/commons-dbcp) 2.x
* [Alibaba Druid](https://github.com/alibaba/druid) 1.x
+ * [HikariCP](https://github.com/brettwooldridge/HikariCP) 3.x -> 4.x
* Logging Framework
* [log4j](https://github.com/apache/log4j) 2.x
* [log4j2](https://github.com/apache/logging-log4j2) 1.2.x
diff --git a/test/plugin/scenarios/hikaricp-scenario/bin/startup.sh b/test/plugin/scenarios/hikaricp-scenario/bin/startup.sh
new file mode 100644
index 0000000..85e4ab6
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/bin/startup.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+home="$(cd "$(dirname $0)"; pwd)"
+
+java -jar ${agent_opts} ${home}/../libs/hikaricp-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..b9ab3d1
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml
@@ -0,0 +1,205 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+segmentItems:
+- serviceName: hikaricp-scenario
+ segmentSize: ge 0
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: HikariCP/Connection/getConnection
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: Mysql/JDBI/Statement/execute
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 33
+ isError: false
+ spanType: Exit
+ peer: mysql-server:3306
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: 'CREATE TABLE test_Hikari(id VARCHAR(1) PRIMARY
+ KEY, value VARCHAR(1) NOT NULL)'}
+ - operationName: HikariCP/Connection/close
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: HikariCP/Connection/getConnection
+ parentSpanId: 0
+ spanId: 4
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: Mysql/JDBI/Statement/execute
+ parentSpanId: 0
+ spanId: 5
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 33
+ isError: false
+ spanType: Exit
+ peer: mysql-server:3306
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: 'INSERT INTO test_Hikari(id, value) VALUES(1,1)'}
+ - operationName: HikariCP/Connection/close
+ parentSpanId: 0
+ spanId: 6
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: HikariCP/Connection/getConnection
+ parentSpanId: 0
+ spanId: 7
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: Mysql/JDBI/Statement/execute
+ parentSpanId: 0
+ spanId: 8
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 33
+ isError: false
+ spanType: Exit
+ peer: mysql-server:3306
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: 'SELECT id, value FROM test_Hikari WHERE id=1'}
+ - operationName: HikariCP/Connection/close
+ parentSpanId: 0
+ spanId: 9
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: HikariCP/Connection/getConnection
+ parentSpanId: 0
+ spanId: 10
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: Mysql/JDBI/Statement/execute
+ parentSpanId: 0
+ spanId: 11
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 33
+ isError: false
+ spanType: Exit
+ peer: mysql-server:3306
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: 'DELETE FROM test_Hikari WHERE id=1'}
+ - operationName: HikariCP/Connection/close
+ parentSpanId: 0
+ spanId: 12
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: HikariCP/Connection/getConnection
+ parentSpanId: 0
+ spanId: 13
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: Mysql/JDBI/Statement/execute
+ parentSpanId: 0
+ spanId: 14
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 33
+ isError: false
+ spanType: Exit
+ peer: mysql-server:3306
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: 'DROP table test_Hikari'}
+ - operationName: HikariCP/Connection/close
+ parentSpanId: 0
+ spanId: 15
+ spanLayer: Unknown
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 116
+ isError: false
+ spanType: Local
+ peer: ''
+ - operationName: /hikaricp-scenario/case/hikaricp-scenario
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 1
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value: 'http://localhost:8080/hikaricp-scenario/case/hikaricp-scenario'}
+ - {key: http.method, value: GET}
diff --git a/test/plugin/scenarios/hikaricp-scenario/configuration.yml b/test/plugin/scenarios/hikaricp-scenario/configuration.yml
new file mode 100644
index 0000000..63c1871
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/configuration.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+type: jvm
+entryService: http://localhost:8080/hikaricp-scenario/case/hikaricp-scenario
+healthCheck: http://localhost:8080/hikaricp-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+depends_on:
+ - mysql-server
+dependencies:
+ mysql-server:
+ image: mysql:5.7
+ hostname: mysql-server
+ expose:
+ - "3306"
+ environment:
+ - MYSQL_ROOT_PASSWORD=root
+ - MYSQL_DATABASE=test
diff --git a/test/plugin/scenarios/hikaricp-scenario/pom.xml b/test/plugin/scenarios/hikaricp-scenario/pom.xml
new file mode 100644
index 0000000..6c37003
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <groupId>org.apache.skywalking.apm.testcase</groupId>
+ <artifactId>hikaricp-scenario</artifactId>
+ <version>1.0.0</version>
+ <packaging>jar</packaging>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <compiler.version>1.8</compiler.version>
+
+ <test.framework.version>3.2.0</test.framework.version>
+ <docker.image.version>${test.framework.version}</docker.image.version>
+
+ <spring-boot-version>2.1.6.RELEASE</spring-boot-version>
+ </properties>
+
+ <name>skywalking-hikaricp-scenario</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot-version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.25</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>hikaricp-scenario</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${compiler.version}</source>
+ <target>${compiler.version}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/assembly.xml</descriptor>
+ </descriptors>
+ <outputDirectory>./target/</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/hikaricp-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..76f043f
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>./bin</directory>
+ <fileMode>0775</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>${project.build.directory}/hikaricp-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/Application.java b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/Application.java
new file mode 100644
index 0000000..6062beb
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/Application.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.hikaricp;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ try {
+ SpringApplication.run(Application.class, args);
+ } catch (Exception e) {
+ // Never do this
+ }
+ }
+}
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/MySQLConfig.java b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/MySQLConfig.java
new file mode 100644
index 0000000..394776a
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/MySQLConfig.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.hikaricp;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class MySQLConfig {
+ private static Logger LOGGER = LogManager.getLogger(MySQLConfig.class);
+ private static String URL;
+ private static String USER_NAME;
+ private static String PASSWORD;
+
+ static {
+ InputStream inputStream = MySQLConfig.class.getClassLoader().getResourceAsStream("/jdbc.properties");
+ Properties properties = new Properties();
+ try {
+ properties.load(inputStream);
+ } catch (IOException e) {
+ LOGGER.error("Failed to load config", e);
+ }
+ URL = properties.getProperty("mysql.url");
+ USER_NAME = properties.getProperty("mysql.username");
+ PASSWORD = properties.getProperty("mysql.password");
+ }
+
+ public static String getUrl() {
+ return URL;
+ }
+
+ public static String getUserName() {
+ return USER_NAME;
+ }
+
+ public static String getPassword() {
+ return PASSWORD;
+ }
+}
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/controller/CaseController.java b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/controller/CaseController.java
new file mode 100644
index 0000000..3afb16c
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/controller/CaseController.java
@@ -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.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.hikaricp.controller;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.skywalking.apm.testcase.hikaricp.service.CaseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/case")
+public class CaseController {
+
+ @Autowired
+ CaseService caseService;
+
+ private static final Logger LOGGER = LogManager.getLogger(CaseController.class);
+
+ private static final String SUCCESS = "Success";
+
+ @RequestMapping("/hikaricp-scenario")
+ @ResponseBody
+ public String testcase() throws Exception {
+ try {
+ caseService.testCase();
+ } catch (Exception e) {
+ LOGGER.error("Failed to execute sql.", e);
+ throw e;
+ }
+ return SUCCESS;
+ }
+
+ @RequestMapping("/healthCheck")
+ @ResponseBody
+ public String healthCheck() throws Exception {
+ return SUCCESS;
+ }
+
+}
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/service/CaseService.java b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/service/CaseService.java
new file mode 100644
index 0000000..05e8011
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/java/org/apache/skywalking/apm/testcase/hikaricp/service/CaseService.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.hikaricp.service;
+
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+import org.apache.skywalking.apm.testcase.hikaricp.MySQLConfig;
+import org.springframework.stereotype.Service;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+@Service
+public class CaseService {
+
+ public static HikariDataSource DS;
+ private static final String CREATE_TABLE_SQL = "CREATE TABLE test_Hikari(id VARCHAR(1) PRIMARY KEY, value VARCHAR(1) NOT NULL)";
+ private static final String INSERT_DATA_SQL = "INSERT INTO test_Hikari(id, value) VALUES(1,1)";
+ private static final String QUERY_DATA_SQL = "SELECT id, value FROM test_Hikari WHERE id=1";
+ private static final String DELETE_DATA_SQL = "DELETE FROM test_Hikari WHERE id=1";
+ private static final String DROP_TABLE_SQL = "DROP table test_Hikari";
+
+ static {
+ HikariConfig config = new HikariConfig();
+ config.setJdbcUrl(MySQLConfig.getUrl());
+ config.setUsername(MySQLConfig.getUserName());
+ config.setPassword(MySQLConfig.getPassword());
+ DS = new HikariDataSource(config);
+ }
+
+ public void testCase() {
+ sqlExecutor(CREATE_TABLE_SQL);
+ sqlExecutor(INSERT_DATA_SQL);
+ sqlExecutor(QUERY_DATA_SQL);
+ sqlExecutor(DELETE_DATA_SQL);
+ sqlExecutor(DROP_TABLE_SQL);
+ }
+
+ public void sqlExecutor(String sql) {
+ try (Connection conn = DS.getConnection()) {
+ Statement statement = conn.createStatement();
+ statement.execute(sql);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/hikaricp-scenario/src/main/resources/application.yaml
new file mode 100644
index 0000000..25503c3
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/resources/application.yaml
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+server:
+ port: 8080
+ servlet:
+ context-path: /hikaricp-scenario
+logging:
+ config: classpath:log4j2.xml
\ No newline at end of file
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/resources/jdbc.properties b/test/plugin/scenarios/hikaricp-scenario/src/main/resources/jdbc.properties
new file mode 100644
index 0000000..5c266c3
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/resources/jdbc.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+mysql.url=jdbc:mysql://mysql-server:3306/test?serverTimezone=CST
+mysql.username=root
+mysql.password=root
diff --git a/test/plugin/scenarios/hikaricp-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/hikaricp-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..9849ed5
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/src/main/resources/log4j2.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_ERR">
+ <PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="WARN">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/test/plugin/scenarios/hikaricp-scenario/support-version.list b/test/plugin/scenarios/hikaricp-scenario/support-version.list
new file mode 100644
index 0000000..68ae9dd
--- /dev/null
+++ b/test/plugin/scenarios/hikaricp-scenario/support-version.list
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+4.0.0
+3.4.0
+3.3.0
+3.2.0
+3.1.0
+3.0.0