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) Deprecated.static <REQUEST,RESPONSE>
HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST> netAttributesGetter) Returns a newHttpServerAttributesExtractorBuilderthat can be used to configure the HTTP client attributes extractor.static <REQUEST,RESPONSE>
HttpServerAttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Deprecated.static <REQUEST,RESPONSE>
HttpServerAttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST> netAttributesGetter) Creates the HTTP server 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
@Deprecated public static <REQUEST,RESPONSE> HttpServerAttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Deprecated.Creates the HTTP server attributes extractor with default configuration. -
create
public static <REQUEST,RESPONSE> HttpServerAttributesExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST> netAttributesGetter) Creates the HTTP server attributes extractor with default configuration. -
builder
@Deprecated public static <REQUEST,RESPONSE> HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter) Deprecated.Returns a newHttpServerAttributesExtractorBuilderthat can be used to configure the HTTP client attributes extractor. -
builder
public static <REQUEST,RESPONSE> HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> builder(HttpServerAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter, NetServerAttributesGetter<REQUEST> netAttributesGetter) 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, NetServerAttributesGetter)instead.