Class SqlCommenterBuilder
java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.db.internal.SqlCommenterBuilder
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 Summary
Modifier and TypeMethodDescriptionbuild()setEnabled(boolean enabled) Enable adding sqlcommenter comments to sql queries.setPrepend(boolean prepend) Prepend the sqlcommenter comment to the query instead of appending it.setPrepend(Predicate<Object> prepend) Prepend the sqlcommenter comment to the query instead of appending it.setPropagator(io.opentelemetry.context.propagation.TextMapPropagator propagator) Set the propagator used to inject tracing context into sql comments.setPropagator(BiFunction<Object, Boolean, io.opentelemetry.context.propagation.TextMapPropagator> propagator) Set the propagator used to inject tracing context into sql comments.
-
Method Details
-
setEnabled
Enable adding sqlcommenter comments to sql queries. Default is disabled. -
setPrepend
Prepend the sqlcommenter comment to the query instead of appending it. Default is to append. -
setPrepend
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. JDBCStatement.execute(String)) immediately after processing. If false, the query could be reused (e.g. JDBCConnection.prepareStatement(String)).
-
build
-