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.
Since:
2.0.0
  • 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.

    • getHttpRequestHeaderNames

      default Iterable<String> getHttpRequestHeaderNames(REQUEST request)
      Returns the names of all headers present on the request, or an empty iterable if they cannot be enumerated.

      This is only called when the configured request header selector uses wildcard patterns or only excluded patterns, in which case the header names to capture cannot be known in advance. Instrumentations that do not implement this method only support selectors that list header names literally.

      Implementations of this method must not return a null value; an empty iterable should be returned instead.

      Since:
      2.31.0
    • 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.

    • getHttpResponseHeaderNames

      default Iterable<String> getHttpResponseHeaderNames(REQUEST request, RESPONSE response)
      Returns the names of all headers present on the response, or an empty iterable if they cannot be enumerated.

      This is only called when the configured response header selector uses wildcard patterns or only excluded patterns, in which case the header names to capture cannot be known in advance. Instrumentations that do not implement this method only support selectors that list header names literally.

      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 iterable should be returned instead.

      Since:
      2.31.0
    • getErrorType

      @Nullable default String getErrorType(REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)
      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: timeout, java.net.UnknownHostException, server_certificate_invalid, 500, _OTHER.