java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.db.internal.SqlCommenterBuilder

public final class SqlCommenterBuilder extends Object
This class is internal and experimental. Its APIs are unstable and can change at any time. Its APIs (or a version of them) may be promoted to the public stable API in the future, but no guarantees are made.
  • Method Details

    • setEnabled

      @CanIgnoreReturnValue public SqlCommenterBuilder setEnabled(boolean enabled)
      Enable adding sqlcommenter comments to sql queries. Default is disabled.
    • setPrepend

      @CanIgnoreReturnValue public SqlCommenterBuilder setPrepend(boolean prepend)
      Prepend the sqlcommenter comment to the query instead of appending it. Default is to append.
    • setPrepend

      @CanIgnoreReturnValue public SqlCommenterBuilder setPrepend(Predicate<Object> prepend)
      Prepend the sqlcommenter comment to the query instead of appending it. Default is to append.
      Parameters:
      prepend - a predicate that receives the database connection. Connection may be a jdbc Connection, R2DBC Connection, or any other connection type used by the data access framework performing the operation.
    • setPropagator

      @CanIgnoreReturnValue public SqlCommenterBuilder setPropagator(io.opentelemetry.context.propagation.TextMapPropagator propagator)
      Set the propagator used to inject tracing context into sql comments. Default is W3C Trace Context propagator.
    • setPropagator

      @CanIgnoreReturnValue public SqlCommenterBuilder setPropagator(BiFunction<Object,Boolean,io.opentelemetry.context.propagation.TextMapPropagator> propagator)
      Set the propagator used to inject tracing context into sql comments. Default is W3C Trace Context propagator.
      Parameters:
      propagator - a function that receives the database connection and whether the query is executed only once or could be reused. Connection may be a JDBC connection, R2DBC connection, or any other connection type used by the data access framework performing the operation. If the second argument to the function is true, the query is executed only once (e.g. JDBC Statement.execute(String)) immediately after processing. If false, the query could be reused (e.g. JDBC Connection.prepareStatement(String)).
    • build

      public SqlCommenter build()