public static IpcStatus forHttpStatusStandard()

in spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcStatus.java [129:161]


  public static IpcStatus forHttpStatusStandard(int httpStatus) {
    IpcStatus status;
    switch (httpStatus) {
      case 200: status = success;       break; // OK
      case 401: status = access_denied; break; // Unauthorized
      case 402: status = access_denied; break; // Payment Required
      case 403: status = access_denied; break; // Forbidden
      case 404: status = success;       break; // Not Found
      case 405: status = bad_request;   break; // Method Not Allowed
      case 406: status = bad_request;   break; // Not Acceptable
      case 407: status = access_denied; break; // Proxy Authentication Required
      case 408: status = timeout;       break; // Request Timeout
      case 429: status = throttled;     break; // Too Many Requests
      case 503: status = unavailable;   break; // Unavailable
      case 511: status = access_denied; break; // Network Authentication Required
      default:
        if (httpStatus < 100) {
          // Shouldn't get here, but since the input value isn't validated it is a possibility
          status = unexpected_error;
        } else if (httpStatus < 400) {
          // All 1xx, 2xx, and 3xx unless otherwise specified will be marked as a success
          status = success;
        } else if (httpStatus < 500) {
          // All 4xx unless otherwise specified will be marked as a bad request
          status = bad_request;
        } else {
          // Anything else is unexpected
          status = unexpected_error;
        }
        break;
    }
    return status;
  }