From 98e29034b2c860522d1a30637317e083fab96116 Mon Sep 17 00:00:00 2001 From: wuwen Date: Tue, 22 Sep 2026 11:21:21 +0800 Subject: [PATCH 1/7] Split HikariCP connection and time metrics --- .../hikaricp/PoolingSealInterceptor.java | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java index a2673afbf9..ebf018aa90 100644 --- a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java @@ -34,11 +34,12 @@ import java.util.function.Supplier; /** - * {@link PoolingSealInterceptor} intercepted the method of HikariCP getting connection. + * Intercepts HikariCP connection acquisition and registers datasource metrics. */ public class PoolingSealInterceptor implements InstanceMethodsAroundInterceptor { - private static final String METER_NAME = "datasource"; + private static final String CONNECTION_METRIC_NAME = "datasource"; + private static final String TIME_METRIC_NAME = "datasource_time"; @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { @@ -57,10 +58,13 @@ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allA tagValue = hikariDataSource.getPoolName(); } final Map>> poolMetricMap = getPoolMetrics(); - final Map>> metricConfigMap = getConfigMetrics(); - poolMetricMap.forEach((key, value) -> MeterFactory.gauge(METER_NAME, value.apply(hikariDataSource.getHikariPoolMXBean())) + final Map>> connectionMetricMap = getConnectionMetrics(); + final Map>> timeMetricMap = getTimeMetrics(); + poolMetricMap.forEach((key, value) -> MeterFactory.gauge(CONNECTION_METRIC_NAME, value.apply(hikariDataSource.getHikariPoolMXBean())) .tag("name", tagValue).tag("status", key).build()); - metricConfigMap.forEach((key, value) -> MeterFactory.gauge(METER_NAME, value.apply(hikariDataSource)) + connectionMetricMap.forEach((key, value) -> MeterFactory.gauge(CONNECTION_METRIC_NAME, value.apply(hikariDataSource)) + .tag("name", tagValue).tag("status", key).build()); + timeMetricMap.forEach((key, value) -> MeterFactory.gauge(TIME_METRIC_NAME, value.apply(hikariDataSource)) .tag("name", tagValue).tag("status", key).build()); return ret; } @@ -79,14 +83,19 @@ private Map>> getPoolMetrics return poolMetricMap; } - private Map>> getConfigMetrics() { - final Map>> metricConfigMap = new HashMap(); - metricConfigMap.put("connectionTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getConnectionTimeout()); - metricConfigMap.put("validationTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getValidationTimeout()); - metricConfigMap.put("idleTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getIdleTimeout()); - metricConfigMap.put("leakDetectionThreshold", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getLeakDetectionThreshold()); - metricConfigMap.put("minimumIdle", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMinimumIdle()); - metricConfigMap.put("maximumPoolSize", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMaximumPoolSize()); - return metricConfigMap; + private Map>> getConnectionMetrics() { + final Map>> connectionMetricMap = new HashMap(); + connectionMetricMap.put("minimumIdle", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMinimumIdle()); + connectionMetricMap.put("maximumPoolSize", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMaximumPoolSize()); + return connectionMetricMap; + } + + private Map>> getTimeMetrics() { + final Map>> timeMetricMap = new HashMap(); + timeMetricMap.put("connectionTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getConnectionTimeout()); + timeMetricMap.put("validationTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getValidationTimeout()); + timeMetricMap.put("idleTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getIdleTimeout()); + timeMetricMap.put("leakDetectionThreshold", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getLeakDetectionThreshold()); + return timeMetricMap; } } From eb0565fdd60cd75f92701a67812c7d0df00f85f9 Mon Sep 17 00:00:00 2001 From: wuwen Date: Tue, 22 Sep 2026 11:33:29 +0800 Subject: [PATCH 2/7] Add changelog entry for HikariCP datasource metric split only --- CHANGES.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a175738df6..f3f50ebf89 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,8 @@ Release Notes. * Fix the `spring-ai-1.x-plugin` `ChatModelStreamInterceptor` leaking its async span when `ChatModel#stream(Prompt)` fails synchronously, which silently dropped the whole `TraceSegment` of the request (apache/skywalking#14098). +* Split HikariCP datasource metrics into `datasource` for connection-related values and + `datasource_time` for timeout-related values to keep metric semantics consistent. * Fix `jedis-4.x-plugin`'s `AbstractConnectionInterceptor` double-stopping the span stack on any Redis-level exception (or a null dynamic field on a pooled/recycled `Connection`), which corrupted the parent trace for the rest of the request (apache/skywalking#14085). @@ -29,7 +31,7 @@ Release Notes. `WebFluxSkyWalkingOperators#continueTracing` previously threw `NoSuchMethodError` because Reactor removed `Signal#getContext()` in 3.5.0. Existing `apm-toolkit-webflux` jars (9.7.0 and earlier) remain instrumented by the agent, so upgrading the agent alone does not force a change. -* Fix the Log4j2 plugin descriptor (`Log4j2Plugins.dat`) missing from the `apm-toolkit-log4j-2.x` jar since 9.5.0, which broke `%traceId` and `%sw_ctx` resolution in Log4j2 `PatternLayout` (apache/skywalking#14006). +* Fix the Log4j2 plugin descriptor (`Log4j2Plugins.dat`) missing from the `apm-toolkit-log4j-2.x` jar since 9.5.0, which broke `%traceId` and `%sw_ctx` resolution in Log4j2 `PatternLayout` (apache/skywalking#14069). * Deploy the root `java-agent` POM to Maven Central again. It is the parent of `apm-application-toolkit` and therefore of every published toolkit artifact, but 9.7.0 skipped it, so resolving any `org.apache.skywalking:apm-toolkit-*:9.7.0` failed with `Non-resolvable parent POM From bbc821b32da1a991749d52ef89d8b6c79f0f48c6 Mon Sep 17 00:00:00 2001 From: wuwen Date: Tue, 22 Sep 2026 11:37:39 +0800 Subject: [PATCH 3/7] Update CHANGES.md --- CHANGES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f3f50ebf89..e940e39fff 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,8 +8,6 @@ Release Notes. * Fix the `spring-ai-1.x-plugin` `ChatModelStreamInterceptor` leaking its async span when `ChatModel#stream(Prompt)` fails synchronously, which silently dropped the whole `TraceSegment` of the request (apache/skywalking#14098). -* Split HikariCP datasource metrics into `datasource` for connection-related values and - `datasource_time` for timeout-related values to keep metric semantics consistent. * Fix `jedis-4.x-plugin`'s `AbstractConnectionInterceptor` double-stopping the span stack on any Redis-level exception (or a null dynamic field on a pooled/recycled `Connection`), which corrupted the parent trace for the rest of the request (apache/skywalking#14085). @@ -31,11 +29,13 @@ Release Notes. `WebFluxSkyWalkingOperators#continueTracing` previously threw `NoSuchMethodError` because Reactor removed `Signal#getContext()` in 3.5.0. Existing `apm-toolkit-webflux` jars (9.7.0 and earlier) remain instrumented by the agent, so upgrading the agent alone does not force a change. -* Fix the Log4j2 plugin descriptor (`Log4j2Plugins.dat`) missing from the `apm-toolkit-log4j-2.x` jar since 9.5.0, which broke `%traceId` and `%sw_ctx` resolution in Log4j2 `PatternLayout` (apache/skywalking#14069). +* Fix the Log4j2 plugin descriptor (`Log4j2Plugins.dat`) missing from the `apm-toolkit-log4j-2.x` jar since 9.5.0, which broke `%traceId` and `%sw_ctx` resolution in Log4j2 `PatternLayout` (apache/skywalking#14006). * Deploy the root `java-agent` POM to Maven Central again. It is the parent of `apm-application-toolkit` and therefore of every published toolkit artifact, but 9.7.0 skipped it, so resolving any `org.apache.skywalking:apm-toolkit-*:9.7.0` failed with `Non-resolvable parent POM ... Could not find artifact org.apache.skywalking:java-agent:pom:9.7.0` (apache/skywalking#13988). +* Split HikariCP datasource metrics into `datasource` for connection-related values and + `datasource_time` for timeout-related values to keep metric semantics consistent. All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/263?closed=1) From 31ddf8335248f0594636286e88b7f35716898f29 Mon Sep 17 00:00:00 2001 From: wuwen Date: Tue, 22 Sep 2026 16:22:42 +0800 Subject: [PATCH 4/7] Rename datasource to datasource_time in expectedData.yaml --- .../scenarios/hikaricp-scenario/config/expectedData.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml index fbecf97a0a..842ad96da6 100644 --- a/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml @@ -233,25 +233,25 @@ meterItems: - {name: status, value: threadsAwaitingConnection} singleValue: ge 0 - meterId: - name: datasource + name: datasource_time tags: - {name: name, value: test_mysql-server:3306} - {name: status, value: connectionTimeout} singleValue: ge 0 - meterId: - name: datasource + name: datasource_time tags: - {name: name, value: test_mysql-server:3306} - {name: status, value: validationTimeout} singleValue: ge 0 - meterId: - name: datasource + name: datasource_time tags: - {name: name, value: test_mysql-server:3306} - {name: status, value: idleTimeout} singleValue: ge 0 - meterId: - name: datasource + name: datasource_time tags: - {name: name, value: test_mysql-server:3306} - {name: status, value: leakDetectionThreshold} From 06635d928f04c46bb821b2aa515edc7a7069e2a1 Mon Sep 17 00:00:00 2001 From: wuwen5 Date: Wed, 23 Sep 2026 09:01:28 +0800 Subject: [PATCH 5/7] Remove datasource timeout metrics from reporting and update related configurations --- CHANGES.md | 4 +-- .../apm/plugin/c3p0/PoolConstants.java | 1 - .../c3p0/PoolingCreationInterceptor.java | 4 --- .../v2/PoolingJmxRegisterInterceptor.java | 1 - .../hikaricp/PoolingSealInterceptor.java | 31 ++++++------------- .../config/expectedData.yaml | 6 ---- .../config/expectedData.yaml | 6 ---- .../config/expectedData.yaml | 6 ---- .../config/expectedData.yaml | 24 -------------- 9 files changed, 11 insertions(+), 72 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e940e39fff..b386d004f0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -34,8 +34,8 @@ Release Notes. `apm-application-toolkit` and therefore of every published toolkit artifact, but 9.7.0 skipped it, so resolving any `org.apache.skywalking:apm-toolkit-*:9.7.0` failed with `Non-resolvable parent POM ... Could not find artifact org.apache.skywalking:java-agent:pom:9.7.0` (apache/skywalking#13988). -* Split HikariCP datasource metrics into `datasource` for connection-related values and - `datasource_time` for timeout-related values to keep metric semantics consistent. +* Stop reporting datasource timeout configuration as metrics. The c3p0 `maxIdleTime`, DBCP `maxWaitMillis` + and HikariCP `connectionTimeout`, `validationTimeout`, `idleTimeout` and `leakDetectionThreshold` gauges are no longer reported. All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/263?closed=1) diff --git a/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolConstants.java b/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolConstants.java index 4536cd5112..1b5cc2cd43 100644 --- a/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolConstants.java +++ b/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolConstants.java @@ -27,7 +27,6 @@ public class PoolConstants { public static final String NUM_TOTAL_CONNECTIONS = "numTotalConnections"; public static final String NUM_BUSY_CONNECTIONS = "numBusyConnections"; public static final String NUM_IDLE_CONNECTIONS = "numIdleConnections"; - public static final String MAX_IDLE_TIME = "maxIdleTime"; public static final String MIN_POOL_SIZE = "minPoolSize"; public static final String MAX_POOL_SIZE = "maxPoolSize"; public static final String INITIAL_POOL_SIZE = "initialPoolSize"; diff --git a/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolingCreationInterceptor.java b/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolingCreationInterceptor.java index 6a5514e8c5..0cbb9b341f 100644 --- a/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolingCreationInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/c3p0-0.9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/c3p0/PoolingCreationInterceptor.java @@ -111,10 +111,6 @@ private Map>> getMetric } return numIdleConnections; }); - metricMap.put( - PoolConstants.MAX_IDLE_TIME, - (ComboPooledDataSource pooledDataSource) -> () -> (double) pooledDataSource.getMaxIdleTime() - ); metricMap.put( PoolConstants.MIN_POOL_SIZE, (ComboPooledDataSource pooledDataSource) -> () -> (double) pooledDataSource.getMinPoolSize() diff --git a/apm-sniffer/apm-sdk-plugin/dbcp-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/dbcp/v2/PoolingJmxRegisterInterceptor.java b/apm-sniffer/apm-sdk-plugin/dbcp-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/dbcp/v2/PoolingJmxRegisterInterceptor.java index 6ea9892cab..45a398ed2c 100644 --- a/apm-sniffer/apm-sdk-plugin/dbcp-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/dbcp/v2/PoolingJmxRegisterInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/dbcp-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/dbcp/v2/PoolingJmxRegisterInterceptor.java @@ -62,7 +62,6 @@ private Map>> getMetric metricMap.put("numActive", (BasicDataSourceMXBean basicDataSource) -> () -> (double) basicDataSource.getNumActive()); metricMap.put("maxTotal", (BasicDataSourceMXBean basicDataSource) -> () -> (double) basicDataSource.getMaxTotal()); metricMap.put("numIdle", (BasicDataSourceMXBean basicDataSource) -> () -> (double) (basicDataSource.getNumIdle())); - metricMap.put("maxWaitMillis", (BasicDataSourceMXBean basicDataSource) -> () -> (double) basicDataSource.getMaxWaitMillis()); metricMap.put("maxIdle", (BasicDataSourceMXBean basicDataSource) -> () -> (double) basicDataSource.getMaxIdle()); metricMap.put("minIdle", (BasicDataSourceMXBean basicDataSource) -> () -> (double) basicDataSource.getMinIdle()); metricMap.put("initialSize", (BasicDataSourceMXBean basicDataSource) -> () -> (double) basicDataSource.getInitialSize()); diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java index ebf018aa90..85c3c66761 100644 --- a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java @@ -38,8 +38,7 @@ */ public class PoolingSealInterceptor implements InstanceMethodsAroundInterceptor { - private static final String CONNECTION_METRIC_NAME = "datasource"; - private static final String TIME_METRIC_NAME = "datasource_time"; + private static final String METER_NAME = "datasource"; @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, MethodInterceptResult result) throws Throwable { @@ -58,13 +57,10 @@ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allA tagValue = hikariDataSource.getPoolName(); } final Map>> poolMetricMap = getPoolMetrics(); - final Map>> connectionMetricMap = getConnectionMetrics(); - final Map>> timeMetricMap = getTimeMetrics(); - poolMetricMap.forEach((key, value) -> MeterFactory.gauge(CONNECTION_METRIC_NAME, value.apply(hikariDataSource.getHikariPoolMXBean())) + final Map>> metricConfigMap = getConfigMetrics(); + poolMetricMap.forEach((key, value) -> MeterFactory.gauge(METER_NAME, value.apply(hikariDataSource.getHikariPoolMXBean())) .tag("name", tagValue).tag("status", key).build()); - connectionMetricMap.forEach((key, value) -> MeterFactory.gauge(CONNECTION_METRIC_NAME, value.apply(hikariDataSource)) - .tag("name", tagValue).tag("status", key).build()); - timeMetricMap.forEach((key, value) -> MeterFactory.gauge(TIME_METRIC_NAME, value.apply(hikariDataSource)) + metricConfigMap.forEach((key, value) -> MeterFactory.gauge(METER_NAME, value.apply(hikariDataSource)) .tag("name", tagValue).tag("status", key).build()); return ret; } @@ -83,19 +79,10 @@ private Map>> getPoolMetrics return poolMetricMap; } - private Map>> getConnectionMetrics() { - final Map>> connectionMetricMap = new HashMap(); - connectionMetricMap.put("minimumIdle", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMinimumIdle()); - connectionMetricMap.put("maximumPoolSize", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMaximumPoolSize()); - return connectionMetricMap; - } - - private Map>> getTimeMetrics() { - final Map>> timeMetricMap = new HashMap(); - timeMetricMap.put("connectionTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getConnectionTimeout()); - timeMetricMap.put("validationTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getValidationTimeout()); - timeMetricMap.put("idleTimeout", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getIdleTimeout()); - timeMetricMap.put("leakDetectionThreshold", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getLeakDetectionThreshold()); - return timeMetricMap; + private Map>> getConfigMetrics() { + final Map>> metricConfigMap = new HashMap(); + metricConfigMap.put("minimumIdle", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMinimumIdle()); + metricConfigMap.put("maximumPoolSize", (HikariConfigMXBean hikariConfigMXBean) -> () -> (double) hikariConfigMXBean.getMaximumPoolSize()); + return metricConfigMap; } } diff --git a/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml index 631a5bb4c3..43734abcdb 100755 --- a/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml @@ -220,12 +220,6 @@ meterItems: - {name: name, value: test_mysql-server:3306} - {name: status, value: initialPoolSize} singleValue: ge 0 - - meterId: - name: datasource - tags: - - {name: name, value: test_mysql-server:3306} - - {name: status, value: maxIdleTime} - singleValue: ge 0 - meterId: name: datasource tags: diff --git a/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml index 35d6453291..4835e8e244 100755 --- a/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml @@ -220,12 +220,6 @@ meterItems: - {name: name, value: test_mysql-server:3306} - {name: status, value: initialPoolSize} singleValue: ge 0 - - meterId: - name: datasource - tags: - - {name: name, value: test_mysql-server:3306} - - {name: status, value: maxIdleTime} - singleValue: ge 0 - meterId: name: datasource tags: diff --git a/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml index 4e3cb7c03a..12ba945f22 100755 --- a/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml @@ -244,12 +244,6 @@ meterItems: - {name: name, value: test_mysql-server:3306} - {name: status, value: numIdle} singleValue: ge 0 - - meterId: - name: datasource - tags: - - {name: name, value: test_mysql-server:3306} - - {name: status, value: maxWaitMillis} - singleValue: ge -1 - meterId: name: datasource tags: diff --git a/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml index 842ad96da6..09fa2f6016 100644 --- a/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml @@ -232,30 +232,6 @@ meterItems: - {name: name, value: test_mysql-server:3306} - {name: status, value: threadsAwaitingConnection} singleValue: ge 0 - - meterId: - name: datasource_time - tags: - - {name: name, value: test_mysql-server:3306} - - {name: status, value: connectionTimeout} - singleValue: ge 0 - - meterId: - name: datasource_time - tags: - - {name: name, value: test_mysql-server:3306} - - {name: status, value: validationTimeout} - singleValue: ge 0 - - meterId: - name: datasource_time - tags: - - {name: name, value: test_mysql-server:3306} - - {name: status, value: idleTimeout} - singleValue: ge 0 - - meterId: - name: datasource_time - tags: - - {name: name, value: test_mysql-server:3306} - - {name: status, value: leakDetectionThreshold} - singleValue: ge 0 - meterId: name: datasource tags: From 96fa6fe17a871c8c41cfb67d00e699db01d0dbf2 Mon Sep 17 00:00:00 2001 From: wuwen5 Date: Wed, 23 Sep 2026 13:44:42 +0800 Subject: [PATCH 6/7] Update meterSize values in expectedData.yaml for various scenarios --- .../c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml | 2 +- .../c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml | 2 +- .../plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml | 2 +- .../plugin/scenarios/hikaricp-scenario/config/expectedData.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml index 43734abcdb..e00cb1f4ab 100755 --- a/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/c3p0-0.9.0.x-0.9.1.x-scenario/config/expectedData.yaml @@ -212,7 +212,7 @@ segmentItems: - {key: http.status_code, value: '200'} meterItems: - serviceName: c3p0-0.9.0.x-0.9.1.x-scenario - meterSize: ge 12 + meterSize: ge 11 meters: - meterId: name: datasource diff --git a/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml index 4835e8e244..800d96e3e6 100755 --- a/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/c3p0-0.9.2.x-0.10.x-scenario/config/expectedData.yaml @@ -212,7 +212,7 @@ segmentItems: - {key: http.status_code, value: '200'} meterItems: - serviceName: c3p0-0.9.2.x-0.10.x-scenario - meterSize: ge 12 + meterSize: ge 11 meters: - meterId: name: datasource diff --git a/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml index 12ba945f22..c1ffcd4fb8 100755 --- a/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dbcp-2.x-scenario/config/expectedData.yaml @@ -224,7 +224,7 @@ segmentItems: - {key: http.status_code, value: '200'} meterItems: - serviceName: dbcp-2.x-scenario - meterSize: ge 12 + meterSize: ge 11 meters: - meterId: name: datasource diff --git a/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml index 09fa2f6016..e3dd796ece 100644 --- a/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/hikaricp-scenario/config/expectedData.yaml @@ -206,7 +206,7 @@ segmentItems: - {key: http.status_code, value: '200'} meterItems: - serviceName: hikaricp-scenario - meterSize: ge 15 + meterSize: ge 11 meters: - meterId: name: datasource From c7f1ac2fda2c675b9778b502cd4158f7fe9ddf0d Mon Sep 17 00:00:00 2001 From: wuwen5 Date: Wed, 23 Sep 2026 16:43:44 +0800 Subject: [PATCH 7/7] Update CHANGES.md and PoolingSealInterceptor.java to clarify datasource metrics reporting changes --- CHANGES.md | 2 +- .../skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9025f145d8..79a40e725d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -40,7 +40,7 @@ Release Notes. `apm-application-toolkit` and therefore of every published toolkit artifact, but 9.7.0 skipped it, so resolving any `org.apache.skywalking:apm-toolkit-*:9.7.0` failed with `Non-resolvable parent POM ... Could not find artifact org.apache.skywalking:java-agent:pom:9.7.0` (apache/skywalking#13988). -* Stop reporting datasource timeout configuration as metrics. The c3p0 `maxIdleTime`, DBCP `maxWaitMillis` +* Stop reporting datasource timeout configuration as metrics. The c3p0 `maxIdleTime`, DBCP `maxWaitMillis` and HikariCP `connectionTimeout`, `validationTimeout`, `idleTimeout` and `leakDetectionThreshold` gauges are no longer reported. All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/263?closed=1) diff --git a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java index 85c3c66761..572ea2f150 100644 --- a/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/hikaricp-3.x-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hikaricp/PoolingSealInterceptor.java @@ -34,7 +34,7 @@ import java.util.function.Supplier; /** - * Intercepts HikariCP connection acquisition and registers datasource metrics. + * Registers HikariCP datasource metrics when the connection pool is sealed. */ public class PoolingSealInterceptor implements InstanceMethodsAroundInterceptor {