Interface HttpCommonAttributesGetter<REQUEST,RESPONSE>

All Known Subinterfaces:
HttpClientAttributesGetter<REQUEST,RESPONSE>, HttpServerAttributesGetter<REQUEST,RESPONSE>

public interface HttpCommonAttributesGetter<REQUEST,RESPONSE>
An interface for getting HTTP attributes common to clients and servers.
  • Method Details

    • getHttpRequestMethod

      @Nullable String getHttpRequestMethod(REQUEST request)
      Returns the HTTP request method.

      Examples: GET, POST, HEAD

    • getHttpRequestHeader

      List<String> getHttpRequestHeader(REQUEST request, String name)
      Returns all values of header named name from 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: 200

      This is called from Instrumenter.end(Context, Object, Object, Throwable), only when response is non-null.

    • getHttpResponseHeader

      List<String> getHttpResponseHeader(REQUEST request, RESPONSE response, String name)
      Returns all values of header named name from the response, or an empty list if there were none.

      This is called from Instrumenter.end(Context, Object, Object, Throwable), only when response is 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 _OTHER will 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.