Class HttpTraceUtil

java.lang.Object
io.opencensus.contrib.http.util.HttpTraceUtil

@ExperimentalApi public final class HttpTraceUtil extends Object
A helper class to provide convenience methods for tracing.
Since:
0.18
  • Method Details

    • parseResponseStatus

      public static final Status parseResponseStatus(int statusCode, @Nullable Throwable error)
      Parse OpenCensus Status from HTTP response status code.

      This method serves a default routine to map HTTP status code to Open Census Status. The mapping is defined in Google API canonical error code, and the behavior is defined in OpenCensus Specs.

      Parameters:
      statusCode - the HTTP response status code. 0 means invalid response.
      error - the error occurred during response transmission (optional).
      Returns:
      the corresponding OpenCensus Status.
      Since:
      0.18