Interface AttributesExtractor<REQUEST,RESPONSE>
-
- All Known Implementing Classes:
CodeAttributesExtractor,DbClientAttributesExtractor,HttpClientAttributesExtractor,HttpServerAttributesExtractor,MessagingAttributesExtractor,NetClientAttributesExtractor,NetServerAttributesExtractor,PeerServiceAttributesExtractor,RpcAttributesExtractor,SqlClientAttributesExtractor
public interface AttributesExtractor<REQUEST,RESPONSE>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, Context, Object)to have it available during sampling.
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description static <REQUEST,RESPONSE,T>
AttributesExtractor<REQUEST,RESPONSE>constant(io.opentelemetry.api.common.AttributeKey<T> attributeKey, T attributeValue)Returns anAttributesExtractorimplementation that always extracts the provided constant value.default voidonEnd(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context context, REQUEST request, RESPONSE response, Throwable error)Extracts attributes from theContext, theAttributesExtractorand eitherAttributesExtractororerrorinto theAttributesBuilderat the end of a request.default voidonEnd(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request, RESPONSE response, Throwable error)Deprecated.default voidonStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request)Extracts attributes from theContextand theAttributesExtractorinto theAttributesBuilderat the beginning of a request.default voidonStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)Deprecated.UseonStart(AttributesBuilder, Context, Object)instead.default <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
default void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request)Extracts attributes from theContextand theAttributesExtractorinto theAttributesBuilderat the beginning of a request.
-
onStart
@Deprecated default void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)
Deprecated.UseonStart(AttributesBuilder, Context, Object)instead.Extracts attributes from theAttributesExtractorinto theAttributesBuilderat the beginning of a request.
-
onEnd
default void onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context context, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)Extracts attributes from theContext, theAttributesExtractorand eitherAttributesExtractororerrorinto theAttributesBuilderat the end of a request.
-
onEnd
@Deprecated default void onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)
Deprecated.Extracts attributes from theAttributesExtractorand eitherAttributesExtractororerrorinto theAttributesBuilderat the end of a request.
-
set
default <T> void set(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.api.common.AttributeKey<T> key, @Nullable T value)Sets thevaluewith the givenkeyto theAttributesBuilderifvalueis notnull.
-
constant
static <REQUEST,RESPONSE,T> AttributesExtractor<REQUEST,RESPONSE> constant(io.opentelemetry.api.common.AttributeKey<T> attributeKey, T attributeValue)
Returns anAttributesExtractorimplementation that always extracts the provided constant value.
-
-