Skip to content

Commit

Permalink
Add Java Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahchan committed Oct 16, 2023
1 parent c5b9c14 commit 02c1bab
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit 02c1bab

Please sign in to comment.