Class HttpClientAttributesExtractor<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor<REQUEST,RESPONSE>
-
- All Implemented Interfaces:
AttributesExtractor<REQUEST,RESPONSE>
public final class HttpClientAttributesExtractor<REQUEST,RESPONSE> extends Object
Extractor of HTTP client attributes. Instrumentation of HTTP client frameworks should extend this class, definingHttpClientAttributesExtractorandHttpClientAttributesExtractorwith the actual request / response types of the instrumented library. If an attribute is not available in this library, it is appropriate to returnnullfrom the protected attribute methods, but implement as many as possible for best compliance with the OpenTelemetry specification.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <REQUEST,RESPONSE>
HttpClientAttributesExtractorBuilder<REQUEST,RESPONSE>builder(HttpClientAttributesGetter<REQUEST,RESPONSE> getter)Returns a newHttpClientAttributesExtractorBuilderthat can be used to configure the HTTP client attributes extractor.static <REQUEST,RESPONSE>
HttpClientAttributesExtractor<REQUEST,RESPONSE>create(HttpClientAttributesGetter<REQUEST,RESPONSE> getter)Creates the HTTP client attributes extractor with default configuration.static <REQUEST,RESPONSE>
HttpClientAttributesExtractor<REQUEST,RESPONSE>create(HttpClientAttributesGetter<REQUEST,RESPONSE> getter, CapturedHttpHeaders capturedHttpHeaders)Deprecated.Usebuilder(HttpClientAttributesGetter)instead.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.-
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
onEnd, onStart, set
-
-
-
-
Method Detail
-
create
public static <REQUEST,RESPONSE> HttpClientAttributesExtractor<REQUEST,RESPONSE> create(HttpClientAttributesGetter<REQUEST,RESPONSE> getter)
Creates the HTTP client attributes extractor with default configuration.
-
create
@Deprecated public static <REQUEST,RESPONSE> HttpClientAttributesExtractor<REQUEST,RESPONSE> create(HttpClientAttributesGetter<REQUEST,RESPONSE> getter, CapturedHttpHeaders capturedHttpHeaders)
Deprecated.Usebuilder(HttpClientAttributesGetter)instead.Creates the HTTP client attributes extractor.- Parameters:
capturedHttpHeaders- A configuration object specifying which HTTP request and response headers should be captured as span attributes.
-
builder
public static <REQUEST,RESPONSE> HttpClientAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpClientAttributesGetter<REQUEST,RESPONSE> getter)
Returns a newHttpClientAttributesExtractorBuilderthat 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>
-
-