Interface HttpCommonAttributesGetter<REQUEST,RESPONSE>
- All Known Subinterfaces:
HttpClientAttributesGetter<REQUEST,,RESPONSE> HttpServerAttributesGetter<REQUEST,RESPONSE>
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetErrorType(REQUEST request, RESPONSE response, Throwable throwable) Returns a description of a class of error the operation ended with.getHttpRequestHeader(REQUEST request, String name) Returns all values of header namednamefrom the request, or an empty list if there were none.getHttpRequestMethod(REQUEST request) Returns the HTTP request method.getHttpResponseHeader(REQUEST request, RESPONSE response, String name) Returns all values of header namednamefrom the response, or an empty list if there were none.getHttpResponseStatusCode(REQUEST request, RESPONSE response, Throwable error) Returns the HTTP response status code.
-
Method Details
-
getHttpRequestMethod
Returns the HTTP request method.Examples:
GET,POST,HEAD -
getHttpRequestHeader
Returns 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.
-
getHttpResponseStatusCode
@Nullable Integer getHttpResponseStatusCode(REQUEST request, RESPONSE response, @Nullable Throwable error) Returns the HTTP response status code.Examples:
200This is called from
Instrumenter.end(Context, Object, Object, Throwable), only whenresponseis non-null. -
getHttpResponseHeader
Returns 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.
-
getErrorType
@Nullable default String getErrorType(REQUEST request, @Nullable RESPONSE response, @Nullable Throwable throwable) Returns a description of a class of error the operation ended with.This method is only called if the request failed before response status code was sent or received.
If this method is not implemented, or if it returns
null, the exception class name (if any was caught) or the value_OTHERwill be used as error type.The cardinality of the error type should be low. The instrumentations implementing this method are recommended to document the custom values they support.
Examples:
Bad Request,java.net.UnknownHostException,request cancelled,_OTHER.
-