Class HttpClientAttributesExtractor<REQUEST,RESPONSE>
java.lang.Object
io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor<REQUEST,RESPONSE>
- All Implemented Interfaces:
io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,,RESPONSE> io.opentelemetry.instrumentation.api.internal.SpanKeyProvider
public final class HttpClientAttributesExtractor<REQUEST,RESPONSE>
extends Object
implements io.opentelemetry.instrumentation.api.internal.SpanKeyProvider
Extractor of HTTP
client attributes. Instrumentation of HTTP client frameworks should extend this class,
defining
HttpClientAttributesExtractor and HttpClientAttributesExtractor with the actual request / response types of the
instrumented library. If an attribute is not available in this library, it is appropriate to
return null from the protected attribute methods, but implement as many as possible for
best compliance with the OpenTelemetry specification.-
Method Summary
Modifier and TypeMethodDescriptionstatic <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.io.opentelemetry.instrumentation.api.internal.SpanKeyThis 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) voidonStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request)
-
Method Details
-
create
public static <REQUEST,RESPONSE> HttpClientAttributesExtractor<REQUEST,RESPONSE> create(HttpClientAttributesGetter<REQUEST, RESPONSE> getter) Creates the HTTP client attributes extractor with default configuration. -
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) -
onEnd
-
internalGetSpanKey
public io.opentelemetry.instrumentation.api.internal.SpanKey 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 interfaceio.opentelemetry.instrumentation.api.internal.SpanKeyProvider
-