Class HttpServerAttributesExtractor<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.instrumenter.http.HttpCommonAttributesExtractor<REQUEST,RESPONSE>
-
- io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesExtractor<REQUEST,RESPONSE>
-
- All Implemented Interfaces:
AttributesExtractor<REQUEST,RESPONSE>
public abstract class HttpServerAttributesExtractor<REQUEST,RESPONSE> extends HttpCommonAttributesExtractor<REQUEST,RESPONSE>
Extractor of HTTP server attributes. Instrumentation of HTTP server frameworks should extend this class, definingHttpServerAttributesExtractorandHttpServerAttributesExtractorwith 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 protectedHttpServerAttributesExtractor()Creates the HTTP server attributes extractor with default configuration.protectedHttpServerAttributesExtractor(CapturedHttpHeaders capturedHttpHeaders)Creates the HTTP server attributes extractor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Stringflavor(REQUEST request)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 Stringroute(REQUEST request)protected abstract Stringscheme(REQUEST request)protected abstract StringserverName(REQUEST request, RESPONSE response)Extracts thehttp.server_namespan attribute.protected abstract Stringtarget(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
-
HttpServerAttributesExtractor
protected HttpServerAttributesExtractor(CapturedHttpHeaders capturedHttpHeaders)
Creates the HTTP server attributes extractor.- Parameters:
capturedHttpHeaders- A configuration object specifying which HTTP request and response headers should be captured as span attributes.
-
HttpServerAttributesExtractor
protected HttpServerAttributesExtractor()
Creates the HTTP server 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>
-
-