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 92292a504b Fix `JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH` was 
not working in some plugins (#784)
92292a504b is described below

commit 92292a504bcb07634e557e746fd582b5aa5c244f
Author: weixiang1862 <[email protected]>
AuthorDate: Thu Dec 11 13:45:19 2025 +0800

    Fix `JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH` was not working in 
some plugins (#784)
---
 CHANGES.md                                                             | 1 +
 .../skywalking/apm/plugin/jdbc/trace/CallableStatementTracing.java     | 3 ++-
 .../skywalking/apm/plugin/jdbc/trace/PreparedStatementTracing.java     | 3 ++-
 .../org/apache/skywalking/apm/plugin/jdbc/trace/StatementTracing.java  | 3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index b27ad9805b..1abe98d2d0 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -23,6 +23,7 @@ Release Notes.
 * Support kafka-clients-3.9.x intercept.
 * Upgrade kafka-clients version in optional-reporter-plugins to 3.9.1.
 * Fix AbstractLogger replaceParam when the replaced string contains a 
replacement marker.
+* Fix `JDBCPluginConfig.Plugin.JDBC.SQL_BODY_MAX_LENGTH` was not working in 
some plugins.
 
 All issues and pull requests are 
[here](https://github.com/apache/skywalking/milestone/242?closed=1)
 
diff --git 
a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/CallableStatementTracing.java
 
b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/CallableStatementTracing.java
index 58bea0fd22..2a3a1f33b0 100644
--- 
a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/CallableStatementTracing.java
+++ 
b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/CallableStatementTracing.java
@@ -23,6 +23,7 @@ import org.apache.skywalking.apm.agent.core.context.tag.Tags;
 import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
 import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
 import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.plugin.jdbc.SqlBodyUtil;
 
 /**
  * {@link CallableStatementTracing} create an exit span when the client call 
the method in the class that extend {@link
@@ -38,7 +39,7 @@ public class CallableStatementTracing {
             Tags.DB_TYPE.set(span, connectInfo.getDBType());
             SpanLayer.asDB(span);
             Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName());
-            Tags.DB_STATEMENT.set(span, sql);
+            Tags.DB_STATEMENT.set(span, SqlBodyUtil.limitSqlBodySize(sql));
             span.setComponent(connectInfo.getComponent());
             return exec.exe(realStatement, sql);
         } catch (SQLException e) {
diff --git 
a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/PreparedStatementTracing.java
 
b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/PreparedStatementTracing.java
index 86989b7b3d..7c70cb65b0 100644
--- 
a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/PreparedStatementTracing.java
+++ 
b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/PreparedStatementTracing.java
@@ -26,6 +26,7 @@ import 
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
 import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
 import org.apache.skywalking.apm.plugin.jdbc.JDBCPluginConfig;
 import org.apache.skywalking.apm.plugin.jdbc.PreparedStatementParameterBuilder;
+import org.apache.skywalking.apm.plugin.jdbc.SqlBodyUtil;
 import org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
 
 /**
@@ -42,7 +43,7 @@ public class PreparedStatementTracing {
         try {
             Tags.DB_TYPE.set(span, connectInfo.getDBType());
             Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName());
-            Tags.DB_STATEMENT.set(span, sql);
+            Tags.DB_STATEMENT.set(span, SqlBodyUtil.limitSqlBodySize(sql));
             span.setComponent(connectInfo.getComponent());
             SpanLayer.asDB(span);
             if (JDBCPluginConfig.Plugin.JDBC.TRACE_SQL_PARAMETERS && 
Objects.nonNull(statementEnhanceInfos)) {
diff --git 
a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/StatementTracing.java
 
b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/StatementTracing.java
index c94b777441..cbac44a6fd 100644
--- 
a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/StatementTracing.java
+++ 
b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/trace/StatementTracing.java
@@ -23,6 +23,7 @@ import 
org.apache.skywalking.apm.agent.core.context.ContextManager;
 import org.apache.skywalking.apm.agent.core.context.tag.Tags;
 import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
 import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
+import org.apache.skywalking.apm.plugin.jdbc.SqlBodyUtil;
 
 /**
  * {@link PreparedStatementTracing} create an exit span when the client call 
the method in the class that extend {@link
@@ -36,7 +37,7 @@ public class StatementTracing {
                 .getDatabasePeer());
             Tags.DB_TYPE.set(span, connectInfo.getDBType());
             Tags.DB_INSTANCE.set(span, connectInfo.getDatabaseName());
-            Tags.DB_STATEMENT.set(span, sql);
+            Tags.DB_STATEMENT.set(span, SqlBodyUtil.limitSqlBodySize(sql));
             span.setComponent(connectInfo.getComponent());
             SpanLayer.asDB(span);
             return exec.exe(realStatement, sql);

Reply via email to