From 02c1bab188603dbcfcc7c6faed25035e9fcec60c Mon Sep 17 00:00:00 2001 From: Hannah Chan Date: Mon, 16 Oct 2023 21:35:47 +1100 Subject: [PATCH] Add Java Docs --- .../OpenTelemetryDataSourceBuilder.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/datasource/OpenTelemetryDataSourceBuilder.java b/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/datasource/OpenTelemetryDataSourceBuilder.java index ccff675cbec0..28f82301c3b2 100644 --- a/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/datasource/OpenTelemetryDataSourceBuilder.java +++ b/instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/datasource/OpenTelemetryDataSourceBuilder.java @@ -10,7 +10,8 @@ import io.opentelemetry.instrumentation.jdbc.internal.JdbcInstrumenterFactory; import javax.sql.DataSource; -public class OpenTelemetryDataSourceBuilder { +/** A builder for {@link OpenTelemetryDataSource}. */ +public final class OpenTelemetryDataSourceBuilder { private final DataSource delegate; @@ -22,23 +23,44 @@ public class OpenTelemetryDataSourceBuilder { private boolean statementSanitizationEnabled = true; - OpenTelemetryDataSourceBuilder(DataSource delegate, OpenTelemetry openTelemetry) { + /** + * Creates a builder for {@link OpenTelemetryDataSource}. + * + * @param delegate the DataSource to wrap + * @param openTelemetry the OpenTelemetry instance to setup for + */ + public OpenTelemetryDataSourceBuilder(DataSource delegate, OpenTelemetry openTelemetry) { this.delegate = delegate; this.openTelemetry = openTelemetry; } + /** + * Configures whether JDBC Connections are instrumented. Default to 'true'. + * + * @param enabled a boolean indicating whether to enable the DataSource instrumenter + */ @CanIgnoreReturnValue public OpenTelemetryDataSourceBuilder enableDataSourceInstrumenter(boolean enabled) { this.dataSourceInstrumenterEnabled = enabled; return this; } + /** + * Configures whether JDBC Statements are instrumented. Defaults to 'true'. + * + * @param enabled a boolean indicating whether to enable the Statement instrumenter + */ @CanIgnoreReturnValue public OpenTelemetryDataSourceBuilder enableStatementInstrumenter(boolean enabled) { this.statementInstrumenterEnabled = enabled; return this; } + /** + * Configures whether JDBC Statements are sanitized. Defaults to 'true'. + * + * @param enabled a boolean indicating whether to enable Statement sanitization + */ @CanIgnoreReturnValue public OpenTelemetryDataSourceBuilder enableStatementSanitization(boolean enabled) { this.statementSanitizationEnabled = enabled;