Class SqlAttributesExtractor<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
-
- io.opentelemetry.instrumentation.api.instrumenter.db.DbAttributesExtractor<REQUEST,RESPONSE>
-
- io.opentelemetry.instrumentation.api.instrumenter.db.SqlAttributesExtractor<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 @Nullable io.opentelemetry.api.common.AttributeKey<String>dbTableAttribute()protected voidonStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)Extracts attributes from theAttributesExtractorinto theAttributesBuilderat the beginning of a request.protected @Nullable Stringoperation(REQUEST request)protected abstract @Nullable StringrawStatement(REQUEST request)protected @Nullable Stringstatement(REQUEST request)protected @Nullable Stringtable(REQUEST request)-
Methods inherited from class io.opentelemetry.instrumentation.api.instrumenter.db.DbAttributesExtractor
connectionString, name, onEnd, system, user
-
Methods inherited from class io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor
set
-
-
-
-
Method Detail
-
onStart
protected final void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)Description copied from class:AttributesExtractorExtracts attributes from theAttributesExtractorinto theAttributesBuilderat the beginning of a request.- Overrides:
onStartin classDbAttributesExtractor<REQUEST,RESPONSE>
-
statement
protected final @Nullable String statement(REQUEST request)
- Specified by:
statementin classDbAttributesExtractor<REQUEST,RESPONSE>
-
operation
protected final @Nullable String operation(REQUEST request)
- Specified by:
operationin classDbAttributesExtractor<REQUEST,RESPONSE>
-
dbTableAttribute
protected abstract @Nullable io.opentelemetry.api.common.AttributeKey<String> dbTableAttribute()
-
-