Class HttpServerAttributesExtractor<REQUEST,RESPONSE>
java.lang.Object
io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractor<REQUEST,RESPONSE>
- All Implemented Interfaces:
AttributesExtractor<REQUEST,,RESPONSE> SpanKeyProvider
public final class HttpServerAttributesExtractor<REQUEST,RESPONSE>
extends Object
implements SpanKeyProvider
Extractor of HTTP
server attributes.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <REQUEST,RESPONSE>
HttpServerAttributesExtractorBuilder<REQUEST, RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Returns a newHttpServerAttributesExtractorBuilderthat can be used to configure the HTTP client attributes extractor.static <REQUEST,RESPONSE>
AttributesExtractor<REQUEST, RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Creates the HTTP server attributes extractor with default configuration.This method is internal and is hence not for public use.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.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.
-
Method Details
-
create
public static <REQUEST,RESPONSE> AttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Creates the HTTP server attributes extractor with default configuration.- See Also:
-
builder
public static <REQUEST,RESPONSE> HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Returns a newHttpServerAttributesExtractorBuilderthat can be used to configure the HTTP client attributes extractor. -
onStart
public void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request) Description copied from interface:AttributesExtractorExtracts attributes from theContextand theAttributesExtractorinto theAttributesBuilderat the beginning of a request.- Specified by:
onStartin interfaceAttributesExtractor<REQUEST,RESPONSE>
-
onEnd
public void onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context context, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error) Description copied from interface:AttributesExtractorExtracts attributes from theContext, theAttributesExtractorand eitherAttributesExtractororerrorinto theAttributesBuilderat the end of a request.- Specified by:
onEndin interfaceAttributesExtractor<REQUEST,RESPONSE>
-
internalGetSpanKey
This method is internal and is hence not for public use. Its API is unstable and can change at any time.- Specified by:
internalGetSpanKeyin interfaceSpanKeyProvider
-