Class HttpServerAttributesExtractor<REQUEST,RESPONSE>
java.lang.Object
io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesExtractor<REQUEST,RESPONSE>
- All Implemented Interfaces:
io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,,RESPONSE> io.opentelemetry.instrumentation.api.internal.SpanKeyProvider
public final class HttpServerAttributesExtractor<REQUEST,RESPONSE>
extends Object
implements io.opentelemetry.instrumentation.api.internal.SpanKeyProvider
Extractor of HTTP
server attributes. Instrumentation of HTTP server frameworks should extend this class,
defining
HttpServerAttributesExtractor and HttpServerAttributesExtractor 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>
HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Returns a newHttpServerAttributesExtractorBuilderthat can be used to configure the HTTP client attributes extractor.static <REQUEST,RESPONSE>
HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST, RESPONSE> netAttributesGetter) Deprecated.static <REQUEST,RESPONSE>
io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Creates the HTTP server attributes extractor with default configuration.static <REQUEST,RESPONSE>
io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST, RESPONSE> netAttributesGetter) Deprecated.Make sure that your getter implements all the network-related methods and usecreate(HttpServerAttributesGetter)instead.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> io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Creates the HTTP server attributes extractor with default configuration. -
create
@Deprecated public static <REQUEST,RESPONSE> io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST, RESPONSE> netAttributesGetter) Deprecated.Make sure that your getter implements all the network-related methods and usecreate(HttpServerAttributesGetter)instead. This method will be removed in the 2.0 release.Creates the HTTP server attributes extractor with default configuration. -
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. -
builder
@Deprecated public static <REQUEST,RESPONSE> HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST, RESPONSE> netAttributesGetter) Deprecated.Make sure that your getter implements all the network-related methods and usebuilder(HttpServerAttributesGetter)instead. This method will be removed in the 2.0 release.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) -
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
-
builder(HttpServerAttributesGetter)instead.