Class HttpExtractor<Q,P>

java.lang.Object
io.opencensus.contrib.http.HttpExtractor<Q,P>
Type Parameters:
Q - the HTTP request entity.
P - the HTTP response entity.
Direct Known Subclasses:
JaxrsClientExtractor, JaxrsContainerExtractor, OcHttpServletExtractor, OcJettyHttpClientExtractor

@ExperimentalApi public abstract class HttpExtractor<Q,P> extends Object
An adaptor to extract information from request and response.

This class provides no-op implementations by default.

Please refer to this document for more information about the HTTP attributes recorded in Open Census.

Since:
0.19
  • Constructor Details

    • HttpExtractor

      public HttpExtractor()
  • Method Details

    • getRoute

      @Nullable public abstract String getRoute(Q request)
      Returns the request route.
      Parameters:
      request - the HTTP request.
      Returns:
      the request route.
      Since:
      0.19
    • getUrl

      @Nullable public abstract String getUrl(Q request)
      Returns the request URL.
      Parameters:
      request - the HTTP request.
      Returns:
      the request URL.
      Since:
      0.19
    • getHost

      @Nullable public abstract String getHost(Q request)
      Returns the request URL host.
      Parameters:
      request - the HTTP request.
      Returns:
      the request URL host.
      Since:
      0.19
    • getMethod

      @Nullable public abstract String getMethod(Q request)
      Returns the request method.
      Parameters:
      request - the HTTP request.
      Returns:
      the request method.
      Since:
      0.19
    • getPath

      @Nullable public abstract String getPath(Q request)
      Returns the request URL path.
      Parameters:
      request - the HTTP request.
      Returns:
      the request URL path.
      Since:
      0.19
    • getUserAgent

      @Nullable public abstract String getUserAgent(Q request)
      Returns the request user agent.
      Parameters:
      request - the HTTP request.
      Returns:
      the request user agent.
      Since:
      0.19
    • getStatusCode

      public abstract int getStatusCode(@Nullable P response)
      Returns the response status code. If the response is null, this method should return 0.
      Parameters:
      response - the HTTP response.
      Returns:
      the response status code.
      Since:
      0.19