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 2019/10/28 00:44:10 UTC

[skywalking] branch master updated: Add postgresql agent sql query param show (#3695)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f69a73  Add postgresql agent sql query param show  (#3695)
7f69a73 is described below

commit 7f69a73d1312888a20489e8429dd65f3d10a52b1
Author: aderm <zh...@163.com>
AuthorDate: Mon Oct 28 08:43:57 2019 +0800

    Add postgresql agent sql query param show  (#3695)
    
    * Add postgresql agent sql query param show
---
 .../skywalking/apm/agent/core/conf/Config.java     | 16 +++++++++++
 .../PSSetterDefinitionOfJDBCInstrumentation.java   |  2 +-
 .../plugin/jdbc/define/StatementEnhanceInfos.java  |  5 ++--
 .../CreateCallableStatementInterceptor.java        |  0
 .../CreatePreparedStatementInterceptor.java        |  0
 .../postgresql/CreateStatementInterceptor.java     |  0
 ...PrepareStatementWithStringArrayInterceptor.java |  0
 ...PreparedStatementExecuteMethodsInterceptor.java | 33 ++++++++++++++++++++++
 .../StatementExecuteMethodsInterceptor.java        |  0
 .../apm/plugin/jdbc/postgresql/Variables.java      |  0
 .../AbstractJdbc2StatementInstrumentation.java     |  0
 .../define/ConnectionInstrumentation.java          |  0
 .../plugin/jdbc/postgresql/define/Constants.java   |  1 -
 .../postgresql/define/DriverInstrumentation.java   |  0
 .../define/Jdbc3ConnectionInstrumentation.java     |  0
 .../define/Jdbc4ConnectionInstrumentation.java     |  0
 .../define/PgCallableStatementInstrumentation.java |  0
 .../define/PgPreparedStatementInstrumentation.java |  0
 ... PgPreparedStatementSetterInstrumentation.java} | 21 ++++++--------
 .../define/PgStatementInstrumentation.java         |  0
 .../src/main/resources/skywalking-plugin.def       |  1 +
 docs/en/setup/service-agent/java-agent/README.md   |  2 ++
 .../bin/startup.sh                                 |  2 +-
 .../config/expectedData.yaml                       |  1 +
 24 files changed, 66 insertions(+), 18 deletions(-)

diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
index c8e0459..18280df 100755
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
@@ -273,6 +273,22 @@ public class Config {
             public static int SQL_PARAMETERS_MAX_LENGTH = 512;
         }
 
+        public static class POSTGRESQL {
+            /**
+             * If set to true, the parameters of the sql (typically {@link java.sql.PreparedStatement}) would be
+             * collected.
+             */
+            public static boolean TRACE_SQL_PARAMETERS = false;
+
+            /**
+             * For the sake of performance, SkyWalking won't save the entire parameters string into the tag, but only
+             * the first {@code SQL_PARAMETERS_MAX_LENGTH} characters.
+             *
+             * Set a negative number to save the complete parameter string to the tag.
+             */
+            public static int SQL_PARAMETERS_MAX_LENGTH = 512;
+        }
+
         public static class SolrJ {
             /**
              * If true, trace all the query parameters(include deleteByIds and deleteByQuery) in Solr query request,
diff --git a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/PSSetterDefinitionOfJDBCInstrumentation.java b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/PSSetterDefinitionOfJDBCInstrumentation.java
index fb7a4c0..7415254 100644
--- a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/PSSetterDefinitionOfJDBCInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/PSSetterDefinitionOfJDBCInstrumentation.java
@@ -45,7 +45,7 @@ public class PSSetterDefinitionOfJDBCInstrumentation implements InstanceMethodsI
     public ElementMatcher<MethodDescription> getMethodsMatcher() {
         ElementMatcher.Junction<MethodDescription> matcher = none();
 
-        if (Config.Plugin.MySQL.TRACE_SQL_PARAMETERS) {
+        if (Config.Plugin.MySQL.TRACE_SQL_PARAMETERS || Config.Plugin.POSTGRESQL.TRACE_SQL_PARAMETERS) {
             final Set<String> setters = ignorable ? PS_IGNORABLE_SETTERS : PS_SETTERS;
             for (String setter : setters) {
                 matcher = matcher.or(named(setter));
diff --git a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/define/StatementEnhanceInfos.java b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/define/StatementEnhanceInfos.java
index 3ec22a4..5c4a0a1 100644
--- a/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/define/StatementEnhanceInfos.java
+++ b/apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/define/StatementEnhanceInfos.java
@@ -19,9 +19,8 @@
 
 package org.apache.skywalking.apm.plugin.jdbc.define;
 
-import org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
-
 import java.util.Arrays;
+import org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
 
 /**
  * {@link StatementEnhanceInfos} contain the {@link ConnectionInfo} and
@@ -58,7 +57,7 @@ public class StatementEnhanceInfos {
         maxIndex = maxIndex > index ? maxIndex : index;
         index--; // start from 1
         if (parameters == null) {
-            final int initialSize = Math.max(20, maxIndex);
+            final int initialSize = Math.max(16, maxIndex);
             parameters = new Object[initialSize];
             Arrays.fill(parameters, null);
         }
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/CreateCallableStatementInterceptor.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/CreateCallableStatementInterceptor.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/CreatePreparedStatementInterceptor.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/CreatePreparedStatementInterceptor.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/CreateStatementInterceptor.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/CreateStatementInterceptor.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/JDBCPrepareStatementWithStringArrayInterceptor.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/JDBCPrepareStatementWithStringArrayInterceptor.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/PreparedStatementExecuteMethodsInterceptor.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/PreparedStatementExecuteMethodsInterceptor.java
old mode 100644
new mode 100755
index 6ad648c..6686e6b
--- a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/PreparedStatementExecuteMethodsInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/PreparedStatementExecuteMethodsInterceptor.java
@@ -20,7 +20,9 @@
 package org.apache.skywalking.apm.plugin.jdbc.postgresql;
 
 import java.lang.reflect.Method;
+import org.apache.skywalking.apm.agent.core.conf.Config;
 import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.tag.StringTag;
 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;
@@ -36,6 +38,9 @@ import org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
  * @author zhangxin
  */
 public class PreparedStatementExecuteMethodsInterceptor implements InstanceMethodsAroundInterceptor {
+
+    public static final StringTag SQL_PARAMETERS = new StringTag("db.sql.parameters");
+
     @Override
     public final void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
         Class<?>[] argumentsTypes,
@@ -48,6 +53,19 @@ public class PreparedStatementExecuteMethodsInterceptor implements InstanceMetho
         Tags.DB_STATEMENT.set(span, cacheObject.getSql());
         span.setComponent(connectInfo.getComponent());
 
+        if (Config.Plugin.POSTGRESQL.TRACE_SQL_PARAMETERS) {
+            final Object[] parameters = cacheObject.getParameters();
+            if (parameters != null && parameters.length > 0) {
+                int maxIndex = cacheObject.getMaxIndex();
+                String parameterString = buildParameterString(parameters, maxIndex);
+                int sqlParametersMaxLength = Config.Plugin.MySQL.SQL_PARAMETERS_MAX_LENGTH;
+                if (sqlParametersMaxLength > 0 && parameterString.length() > sqlParametersMaxLength) {
+                    parameterString = parameterString.substring(0, sqlParametersMaxLength) + "..." + "]";
+                }
+                SQL_PARAMETERS.set(span, parameterString);
+            }
+        }
+
         SpanLayer.asDB(span);
     }
 
@@ -73,4 +91,19 @@ public class PreparedStatementExecuteMethodsInterceptor implements InstanceMetho
     private String buildOperationName(ConnectionInfo connectionInfo, String methodName, String statementName) {
         return connectionInfo.getDBType() + "/JDBI/" + statementName + "/" + methodName;
     }
+
+    private String buildParameterString(Object[] parameters, int maxIndex) {
+        String parameterString = "[";
+        boolean first = true;
+        for (int i = 0; i < maxIndex; i++) {
+            Object parameter = parameters[i];
+            if (!first) {
+                parameterString += ",";
+            }
+            parameterString += parameter;
+            first = false;
+        }
+        parameterString += "]";
+        return parameterString;
+    }
 }
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/StatementExecuteMethodsInterceptor.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/StatementExecuteMethodsInterceptor.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/Variables.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/Variables.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/AbstractJdbc2StatementInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/AbstractJdbc2StatementInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/ConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/ConnectionInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Constants.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Constants.java
old mode 100644
new mode 100755
index 662d12c..cda27df
--- a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Constants.java
+++ b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Constants.java
@@ -28,5 +28,4 @@ public class Constants {
     public static final String CREATE_STATEMENT_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.jdbc.postgresql.CreateStatementInterceptor";
     public static final String CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.jdbc.postgresql.CreatePreparedStatementInterceptor";
     public static final String CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.jdbc.postgresql.CreateCallableStatementInterceptor";
-
 }
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/DriverInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/DriverInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc3ConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc3ConnectionInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc4ConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/Jdbc4ConnectionInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgCallableStatementInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgCallableStatementInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgPreparedStatementInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgPreparedStatementInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/DriverInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgPreparedStatementSetterInstrumentation.java
similarity index 63%
copy from apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/DriverInstrumentation.java
copy to apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgPreparedStatementSetterInstrumentation.java
index e431ca1..3893b43 100644
--- a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/DriverInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgPreparedStatementSetterInstrumentation.java
@@ -15,24 +15,21 @@
  * limitations under the License.
  *
  */
-
-
 package org.apache.skywalking.apm.plugin.jdbc.postgresql.define;
 
-import org.apache.skywalking.apm.plugin.jdbc.define.AbstractDriverInstrumentation;
-import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
-
-import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.plugin.jdbc.PSSetterDefinitionOfJDBCInstrumentation;
 
 /**
- * {@link DriverInstrumentation} presents that skywalking intercepts {@link org.postgresql.Driver}.
- *
- * @author zhangxin
+ * @author aderm
  */
-public class DriverInstrumentation extends AbstractDriverInstrumentation {
+public class PgPreparedStatementSetterInstrumentation extends PgPreparedStatementInstrumentation {
 
     @Override
-    protected ClassMatch enhanceClass() {
-        return byName("org.postgresql.Driver");
+    public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+        return new InstanceMethodsInterceptPoint[] {
+            new PSSetterDefinitionOfJDBCInstrumentation(false)
+        };
     }
+
 }
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgStatementInstrumentation.java b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/PgStatementInstrumentation.java
old mode 100644
new mode 100755
diff --git a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def
old mode 100644
new mode 100755
index c1e3e0d..e744f20
--- a/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/resources/skywalking-plugin.def
@@ -22,3 +22,4 @@ postgresql-8.x=org.apache.skywalking.apm.plugin.jdbc.postgresql.define.AbstractJ
 postgresql-8.x=org.apache.skywalking.apm.plugin.jdbc.postgresql.define.PgCallableStatementInstrumentation
 postgresql-8.x=org.apache.skywalking.apm.plugin.jdbc.postgresql.define.PgPreparedStatementInstrumentation
 postgresql-8.x=org.apache.skywalking.apm.plugin.jdbc.postgresql.define.PgStatementInstrumentation
+postgresql-8.x=org.apache.skywalking.apm.plugin.jdbc.postgresql.define.PgPreparedStatementSetterInstrumentation
diff --git a/docs/en/setup/service-agent/java-agent/README.md b/docs/en/setup/service-agent/java-agent/README.md
index e558614..979837a 100755
--- a/docs/en/setup/service-agent/java-agent/README.md
+++ b/docs/en/setup/service-agent/java-agent/README.md
@@ -102,6 +102,8 @@ property key | Description | Default |
 `plugin.toolit.use_qualified_name_as_operation_name`|If true, the fully qualified method name will be used as the operation name instead of the given operation name, default is false.|`false`|
 `plugin.mysql.trace_sql_parameters`|If set to true, the parameters of the sql (typically `java.sql.PreparedStatement`) would be collected.|`false`|
 `plugin.mysql.sql_parameters_max_length`|If set to positive number, the `db.sql.parameters` would be truncated to this length, otherwise it would be completely saved, which may cause performance problem.|`512`|
+`plugin.postgresql.trace_sql_parameters`|If set to true, the parameters of the sql (typically `java.sql.PreparedStatement`) would be collected.|`false`|
+`plugin.postgresql.sql_parameters_max_length`|If set to positive number, the `db.sql.parameters` would be truncated to this length, otherwise it would be completely saved, which may cause performance problem.|`512`|
 `plugin.solrj.trace_statement`|If true, trace all the query parameters(include deleteByIds and deleteByQuery) in Solr query request, default is false.|`false`|
 `plugin.solrj.trace_ops_params`|If true, trace all the operation parameters in Solr request, default is false.|`false`|
 `plugin.light4j.trace_handler_chain`|If true, trace all middleware/business handlers that are part of the Light4J handler chain for a request.|false|
diff --git a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/bin/startup.sh b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/bin/startup.sh
index b5f8537..ff5042d 100644
--- a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/bin/startup.sh
+++ b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/bin/startup.sh
@@ -17,4 +17,4 @@
 
 home="$(cd "$(dirname $0)"; pwd)"
 
-java -jar ${agent_opts} ${home}/../libs/postgresql-above9.4.1207-scenario.jar &
+java -jar ${agent_opts} -Dskywalking.plugin.postgresql.trace_sql_parameters=true ${home}/../libs/postgresql-above9.4.1207-scenario.jar &
diff --git a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml
index efa343e..bb5260b 100644
--- a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml
@@ -53,6 +53,7 @@ segmentItems:
         - {key: "db.type", value: "sql"}
         - {key: "db.instance", value: "postgres"}
         - {key: "db.statement", value: "INSERT INTO test_007(id, value) VALUES(?,?)"}
+        - {key: "db.sql.parameters", value: "[1,1]"}
         startTime: nq 0
         endTime: nq 0
         isError: false