Class DatabaseClientTracer<CONNECTION,STATEMENT,SANITIZEDSTATEMENT>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.tracer.BaseTracer
-
- io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer<CONNECTION,STATEMENT,SANITIZEDSTATEMENT>
-
- Type Parameters:
CONNECTION- type of the database connection.STATEMENT- type of the database statement being executed.SANITIZEDSTATEMENT- type of the database statement after sanitization.
public abstract class DatabaseClientTracer<CONNECTION,STATEMENT,SANITIZEDSTATEMENT> extends BaseTracer
Base class for implementing Tracers for database clients.
-
-
Constructor Summary
Constructors Constructor Description DatabaseClientTracer(io.opentelemetry.api.OpenTelemetry openTelemetry, NetPeerAttributes netPeerAttributes)DatabaseClientTracer(NetPeerAttributes netPeerAttributes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringconventionSpanName(@Nullable String dbName, @Nullable String operation, @Nullable String table)A helper method for constructing the span name formatting according to DB semantic conventions:<db.operation> <db.name><table>.static StringconventionSpanName(@Nullable String dbName, @Nullable String operation, @Nullable String table, String defaultValue)A helper method for constructing the span name formatting according to DB semantic conventions:<db.operation> <db.name><table>.booleanshouldStartSpan(io.opentelemetry.context.Context parentContext)io.opentelemetry.context.ContextstartSpan(io.opentelemetry.context.Context parentContext, CONNECTION connection, STATEMENT statement)-
Methods inherited from class io.opentelemetry.instrumentation.api.tracer.BaseTracer
end, end, endExceptionally, endExceptionally, extract, inject, onException, shouldStartSpan, spanNameForClass, spanNameForMethod, spanNameForMethod, spanNameForMethod, startSpan, startSpan, startSpan
-
-
-
-
Constructor Detail
-
DatabaseClientTracer
public DatabaseClientTracer(NetPeerAttributes netPeerAttributes)
-
DatabaseClientTracer
public DatabaseClientTracer(io.opentelemetry.api.OpenTelemetry openTelemetry, NetPeerAttributes netPeerAttributes)
-
-
Method Detail
-
shouldStartSpan
public boolean shouldStartSpan(io.opentelemetry.context.Context parentContext)
-
startSpan
public io.opentelemetry.context.Context startSpan(io.opentelemetry.context.Context parentContext, CONNECTION connection, STATEMENT statement)
-
conventionSpanName
public static String conventionSpanName(@Nullable String dbName, @Nullable String operation, @Nullable String table)
A helper method for constructing the span name formatting according to DB semantic conventions:<db.operation> <db.name><table>.
-
conventionSpanName
public static String conventionSpanName(@Nullable String dbName, @Nullable String operation, @Nullable String table, String defaultValue)
A helper method for constructing the span name formatting according to DB semantic conventions:<db.operation> <db.name><table>. IfdbNameandoperationare not provided thendefaultValueis returned.
-
-