diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index a4dff171e..53ae22a1f 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -46,7 +46,7 @@ |spring.sleuth.jdbc.p6spy.log-format | | Custom log format. |spring.sleuth.jdbc.p6spy.logging | | Logging to use for logging queries. |spring.sleuth.jdbc.p6spy.multiline | `true` | Enables multiline output. -|spring.sleuth.jdbc.p6spy.tracing.include-parameter-values | `true` | Report the effective sql string (with '?' replaced with real values) to tracing systems.
NOTE this setting does not affect the logging message. +|spring.sleuth.jdbc.p6spy.tracing.include-parameter-values | `false` | Report the effective sql string (with '?' replaced with real values) to tracing systems.
NOTE this setting does not affect the logging message.
|spring.sleuth.kafka.enabled | `true` | Enable instrumenting of Apache Kafka clients.
|spring.sleuth.messaging.aspect.enabled | `false` | Should {@link MessageMapping} wrapping be enabled.
|spring.sleuth.messaging.enabled | `false` | Should messaging be turned on.
diff --git a/docs/src/main/asciidoc/integrations.adoc b/docs/src/main/asciidoc/integrations.adoc
index e9339de98..a01ccc32b 100644
--- a/docs/src/main/asciidoc/integrations.adoc
+++ b/docs/src/main/asciidoc/integrations.adoc
@@ -768,9 +768,11 @@ runtimeOnly "net.ttddyy:datasource-proxy:${datasourceProxyVersion}"
Please check the <
* NOTE this setting does not affect the logging message.
*/
- private boolean includeParameterValues = true;
+ private boolean includeParameterValues;
public boolean isIncludeParameterValues() {
return this.includeParameterValues;
diff --git a/spring-cloud-sleuth-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/instrument/tx/AbstractTransactionManagerInstrumenter.java b/spring-cloud-sleuth-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/instrument/tx/AbstractTransactionManagerInstrumenter.java
index 19dff7851..ca1d629e3 100644
--- a/spring-cloud-sleuth-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/instrument/tx/AbstractTransactionManagerInstrumenter.java
+++ b/spring-cloud-sleuth-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/instrument/tx/AbstractTransactionManagerInstrumenter.java
@@ -21,7 +21,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executor;
import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;
diff --git a/tests/common/src/main/java/org/springframework/cloud/sleuth/instrument/jdbc/TraceJdbcEventListenerTests.java b/tests/common/src/main/java/org/springframework/cloud/sleuth/instrument/jdbc/TraceJdbcEventListenerTests.java
index 0667649d1..c4d288c0f 100644
--- a/tests/common/src/main/java/org/springframework/cloud/sleuth/instrument/jdbc/TraceJdbcEventListenerTests.java
+++ b/tests/common/src/main/java/org/springframework/cloud/sleuth/instrument/jdbc/TraceJdbcEventListenerTests.java
@@ -51,7 +51,32 @@ public abstract class TraceJdbcEventListenerTests extends TraceListenerStrategyT
@Test
void testShouldUsePlaceholderInSqlTagOfSpansForPreparedStatementIfIncludeParameterValuesIsSetToFalse() {
- contextRunner.withPropertyValues("spring.sleuth.jdbc.p6spy.tracing.include-parameter-values=false")
+ contextRunner.run(context -> {
+ DataSource dataSource = context.getBean(DataSource.class);
+ TestSpanHandler spanReporter = context.getBean(TestSpanHandler.class);
+
+ Connection connection = dataSource.getConnection();
+ PreparedStatement preparedStatement = connection
+ .prepareStatement("UPDATE INFORMATION_SCHEMA.TABLES SET table_Name = ? WHERE 0 = ?");
+ preparedStatement.setString(1, "");
+ preparedStatement.setInt(2, 1);
+ preparedStatement.executeUpdate();
+ connection.close();
+
+ assertThat(spanReporter.reportedSpans()).hasSize(2);
+ FinishedSpan connectionSpan = spanReporter.reportedSpans().get(1);
+ FinishedSpan statementSpan = spanReporter.reportedSpans().get(0);
+ assertThat(connectionSpan.getName()).isEqualTo("connection");
+ assertThat(statementSpan.getName()).isEqualTo("update");
+ assertThat(statementSpan.getTags()).containsEntry(SPAN_SQL_QUERY_TAG_NAME,
+ "UPDATE INFORMATION_SCHEMA.TABLES SET table_Name = ? WHERE 0 = ?");
+ assertThat(statementSpan.getTags()).containsEntry(SPAN_ROW_COUNT_TAG_NAME, "0");
+ });
+ }
+
+ @Test
+ void testShouldNotUsePlaceholderInSqlTagOfSpansForPreparedStatementIfIncludeParameterValuesIsSetToTrue() {
+ contextRunner.withPropertyValues("spring.sleuth.jdbc.p6spy.tracing.include-parameter-values=true")
.run(context -> {
DataSource dataSource = context.getBean(DataSource.class);
TestSpanHandler spanReporter = context.getBean(TestSpanHandler.class);
@@ -70,7 +95,7 @@ public abstract class TraceJdbcEventListenerTests extends TraceListenerStrategyT
assertThat(connectionSpan.getName()).isEqualTo("connection");
assertThat(statementSpan.getName()).isEqualTo("update");
assertThat(statementSpan.getTags()).containsEntry(SPAN_SQL_QUERY_TAG_NAME,
- "UPDATE INFORMATION_SCHEMA.TABLES SET table_Name = ? WHERE 0 = ?");
+ "UPDATE INFORMATION_SCHEMA.TABLES SET table_Name = '' WHERE 0 = 1");
assertThat(statementSpan.getTags()).containsEntry(SPAN_ROW_COUNT_TAG_NAME, "0");
});
}