Skip to content

Commit

Permalink
add otel.instrumentation.r2dbc.statement-sanitizer.enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger committed May 17, 2024
1 parent c060a7a commit aa72425
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
import io.opentelemetry.instrumentation.r2dbc.v1_0.R2dbcTelemetry;
import io.opentelemetry.instrumentation.r2dbc.v1_0.internal.R2dbcNetAttributesGetter;
import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig;

public final class R2dbcSingletons {

private static final R2dbcTelemetry TELEMETRY =
R2dbcTelemetry.builder(GlobalOpenTelemetry.get())
.setStatementSanitizationEnabled(CommonConfig.get().isStatementSanitizationEnabled())
.setStatementSanitizationEnabled(
InstrumentationConfig.get()
.getBoolean(
"otel.instrumentation.r2dbc.statement-sanitizer.enabled",
CommonConfig.get().isStatementSanitizationEnabled()))
.addAttributeExtractor(
PeerServiceAttributesExtractor.create(
R2dbcNetAttributesGetter.INSTANCE, CommonConfig.get().getPeerServiceResolver()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {
if (bean instanceof ConnectionFactory && !ScopedProxyUtils.isScopedTarget(beanName)) {
ConnectionFactory connectionFactory = (ConnectionFactory) bean;
return R2dbcTelemetry.builder(openTelemetryProvider.getObject())
// there is no instrumentation-specific property, so we use the common one
.setStatementSanitizationEnabled(
InstrumentationConfigUtil.isStatementSanitizationEnabled(
configPropertiesProvider.getObject(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@
"description": "Enables the DB statement sanitization.",
"defaultValue": true
},

{
"name": "otel.instrumentation.kafka.enabled",
"type": "java.lang.Boolean",
Expand Down Expand Up @@ -372,7 +371,13 @@
{
"name": "otel.instrumentation.r2dbc.enabled",
"type": "java.lang.Boolean",
"description": "Enable the R2DBC (reactive JDBC) instrumentation. Also see <code>otel.instrumentation.common.db-statement-sanitizer.enabled</code>.",
"description": "Enable the R2DBC (reactive JDBC) instrumentation.",
"defaultValue": true
},
{
"name": "otel.instrumentation.r2dbc.statement-sanitizer.enabled",
"type": "java.lang.Boolean",
"description": "Enables the DB statement sanitization.",
"defaultValue": true
},
{
Expand Down

0 comments on commit aa72425

Please sign in to comment.