Class AttributesExtractor<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
-
- Direct Known Subclasses:
CodeAttributesExtractor,DbAttributesExtractor,HttpAttributesExtractor,MessagingAttributesExtractor,NetAttributesExtractor,RpcAttributesExtractor
public abstract class AttributesExtractor<REQUEST,RESPONSE> extends Object
Extractor ofAttributesfor a given request and response. Will be called on start with just theAttributesExtractorand again on end with bothAttributesExtractorandAttributesExtractorto allow populating attributes at each stage of a request's lifecycle. It is best to populate as much as possible inonStart(AttributesBuilder, Object)to have it available during sampling.
-
-
Constructor Summary
Constructors Constructor Description AttributesExtractor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidonEnd(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response)Extracts attributes from theAttributesExtractorandAttributesExtractorinto theAttributesBuilderat the end of a request.protected abstract voidonStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)Extracts attributes from theAttributesExtractorinto theAttributesBuilderat the beginning of a request.protected static <T> voidset(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.api.common.AttributeKey<T> key, T value)Sets thevaluewith the givenkeyto theAttributesBuilderifvalueis notnull.
-
-
-
Method Detail
-
onStart
protected abstract void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)Extracts attributes from theAttributesExtractorinto theAttributesBuilderat the beginning of a request.
-
onEnd
protected abstract void onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response)Extracts attributes from theAttributesExtractorandAttributesExtractorinto theAttributesBuilderat the end of a request.
-
set
protected static <T> void set(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.api.common.AttributeKey<T> key, T value)Sets thevaluewith the givenkeyto theAttributesBuilderifvalueis notnull.
-
-