Class SqlAttributesExtractor<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.instrumenter.db.DbAttributesExtractor<REQUEST,RESPONSE>
-
- io.opentelemetry.instrumentation.api.instrumenter.db.SqlAttributesExtractor<REQUEST,RESPONSE>
-
- All Implemented Interfaces:
AttributesExtractor<REQUEST,RESPONSE>
public abstract class SqlAttributesExtractor<REQUEST,RESPONSE> extends DbAttributesExtractor<REQUEST,RESPONSE>
Extractor of database attributes. This class is designed with SQL (or SQL-like) database clients in mind. Aside from adding the same attributes asDbAttributesExtractor
, it has two more features:- It sanitizes the raw SQL query and removes all parameters;
- It enables adding the table name extracted by the sanitizer as a parameter.
-
-
Constructor Summary
Constructors Constructor Description SqlAttributesExtractor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract io.opentelemetry.api.common.AttributeKey<String>
dbTableAttribute()
void
onStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)
Extracts attributes from theAttributesExtractor
into theAttributesBuilder
at the beginning of a request.protected String
operation(REQUEST request)
protected abstract String
rawStatement(REQUEST request)
protected String
statement(REQUEST request)
protected String
table(REQUEST request)
-
Methods inherited from class io.opentelemetry.instrumentation.api.instrumenter.db.DbAttributesExtractor
connectionString, name, onEnd, system, user
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor
set
-
-
-
-
Method Detail
-
onStart
public final void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)
Description copied from interface:AttributesExtractor
Extracts attributes from theAttributesExtractor
into theAttributesBuilder
at the beginning of a request.- Specified by:
onStart
in interfaceAttributesExtractor<REQUEST,RESPONSE>
- Overrides:
onStart
in classDbAttributesExtractor<REQUEST,RESPONSE>
-
statement
@Nullable protected final String statement(REQUEST request)
- Specified by:
statement
in classDbAttributesExtractor<REQUEST,RESPONSE>
-
operation
@Nullable protected final String operation(REQUEST request)
- Specified by:
operation
in classDbAttributesExtractor<REQUEST,RESPONSE>
-
dbTableAttribute
@Nullable protected abstract io.opentelemetry.api.common.AttributeKey<String> dbTableAttribute()
-
-