Class HttpClientAttributesExtractor<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.instrumenter.http.HttpCommonAttributesExtractor<REQUEST,RESPONSE>
-
- io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor<REQUEST,RESPONSE>
-
- All Implemented Interfaces:
AttributesExtractor<REQUEST,RESPONSE>
public abstract class HttpClientAttributesExtractor<REQUEST,RESPONSE> extends HttpCommonAttributesExtractor<REQUEST,RESPONSE>
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.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpClientAttributesExtractor()Creates the HTTP client attributes extractor with default configuration.protectedHttpClientAttributesExtractor(CapturedHttpHeaders capturedHttpHeaders)Creates the HTTP client attributes extractor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Stringflavor(REQUEST request, RESPONSE response)Extracts thehttp.flavorspan attribute.voidonEnd(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request, RESPONSE response, Throwable error)Extracts attributes from theAttributesExtractorand eitherAttributesExtractororerrorinto theAttributesBuilderat the end of a request.voidonStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)Extracts attributes from theAttributesExtractorinto theAttributesBuilderat the beginning of a request.protected abstract Stringurl(REQUEST request)-
Methods inherited from class io.opentelemetry.instrumentation.api.instrumenter.http.HttpCommonAttributesExtractor
method, requestContentLength, requestContentLengthUncompressed, requestHeader, responseContentLength, responseContentLengthUncompressed, responseHeader, statusCode
-
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
set
-
-
-
-
Constructor Detail
-
HttpClientAttributesExtractor
protected HttpClientAttributesExtractor(CapturedHttpHeaders capturedHttpHeaders)
Creates the HTTP client attributes extractor.- Parameters:
capturedHttpHeaders- A configuration object specifying which HTTP request and response headers should be captured as span attributes.
-
HttpClientAttributesExtractor
protected HttpClientAttributesExtractor()
Creates the HTTP client attributes extractor with default configuration.
-
-
Method Detail
-
onStart
public final void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request)Description copied from interface:AttributesExtractorExtracts attributes from theAttributesExtractorinto theAttributesBuilderat the beginning of a request.- Specified by:
onStartin interfaceAttributesExtractor<REQUEST,RESPONSE>- Overrides:
onStartin classHttpCommonAttributesExtractor<REQUEST,RESPONSE>
-
onEnd
public final void onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)Description copied from interface:AttributesExtractorExtracts attributes from theAttributesExtractorand eitherAttributesExtractororerrorinto theAttributesBuilderat the end of a request.- Specified by:
onEndin interfaceAttributesExtractor<REQUEST,RESPONSE>- Overrides:
onEndin classHttpCommonAttributesExtractor<REQUEST,RESPONSE>
-
-