Class HttpCommonAttributesExtractor<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.instrumenter.http.HttpCommonAttributesExtractor<REQUEST,RESPONSE>
-
- All Implemented Interfaces:
AttributesExtractor<REQUEST,RESPONSE>
- Direct Known Subclasses:
HttpClientAttributesExtractor,HttpServerAttributesExtractor
public abstract class HttpCommonAttributesExtractor<REQUEST,RESPONSE> extends Object implements AttributesExtractor<REQUEST,RESPONSE>
Extractor of HTTP attributes that are common to client and server instrumentations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Stringmethod(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 LongrequestContentLength(REQUEST request, RESPONSE response)Extracts thehttp.request_content_lengthspan attribute.protected abstract LongrequestContentLengthUncompressed(REQUEST request, RESPONSE response)Extracts thehttp.request_content_length_uncompressedspan attribute.protected abstract List<String>requestHeader(REQUEST request, String name)Extracts all values of header namednamefrom the request, or an empty list if there were none.protected abstract LongresponseContentLength(REQUEST request, RESPONSE response)Extracts thehttp.response_content_lengthspan attribute.protected abstract LongresponseContentLengthUncompressed(REQUEST request, RESPONSE response)Extracts thehttp.response_content_length_uncompressedspan attribute.protected abstract List<String>responseHeader(REQUEST request, RESPONSE response, String name)Extracts all values of header namednamefrom the response, or an empty list if there were none.protected abstract IntegerstatusCode(REQUEST request, RESPONSE response)Extracts thehttp.status_codespan attribute.-
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
-
-
-
-
Method Detail
-
onStart
public 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>
-
onEnd
public 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>
-
requestHeader
protected abstract List<String> requestHeader(REQUEST request, String name)
Extracts all values of header namednamefrom the request, or an empty list if there were none.Implementations of this method must not return a null value; an empty list should be returned instead.
-
requestContentLength
@Nullable protected abstract Long requestContentLength(REQUEST request, @Nullable RESPONSE response)
Extracts thehttp.request_content_lengthspan attribute.This is called from
Instrumenter.end(Context, Object, Object, Throwable), whetherresponseisnullor not.
-
requestContentLengthUncompressed
@Nullable protected abstract Long requestContentLengthUncompressed(REQUEST request, @Nullable RESPONSE response)
Extracts thehttp.request_content_length_uncompressedspan attribute.This is called from
Instrumenter.end(Context, Object, Object, Throwable), whetherresponseisnullor not.
-
statusCode
@Nullable protected abstract Integer statusCode(REQUEST request, RESPONSE response)
Extracts thehttp.status_codespan attribute.This is called from
Instrumenter.end(Context, Object, Object, Throwable), only whenresponseis non-null.
-
responseContentLength
@Nullable protected abstract Long responseContentLength(REQUEST request, RESPONSE response)
Extracts thehttp.response_content_lengthspan attribute.This is called from
Instrumenter.end(Context, Object, Object, Throwable), only whenresponseis non-null.
-
responseContentLengthUncompressed
@Nullable protected abstract Long responseContentLengthUncompressed(REQUEST request, RESPONSE response)
Extracts thehttp.response_content_length_uncompressedspan attribute.This is called from
Instrumenter.end(Context, Object, Object, Throwable), only whenresponseis non-null.
-
responseHeader
protected abstract List<String> responseHeader(REQUEST request, RESPONSE response, String name)
Extracts all values of header namednamefrom the response, or an empty list if there were none.This is called from
Instrumenter.end(Context, Object, Object, Throwable), only whenresponseis non-null.Implementations of this method must not return a null value; an empty list should be returned instead.
-
-