code: public static EndSpanOptions getEndSpanOptions(@Nullable Integer statusCode) {
      // Always sample the span, but optionally export it.
      EndSpanOptions.Builder builder = EndSpanOptions.builder();
      if (statusCode == null) {
        builder.setStatus(Status.UNKNOWN);
      } else if (!HttpStatusCodes.isSuccess(statusCode)) {
        switch (statusCode) {
          case HttpStatusCodes.STATUS_CODE_BAD_REQUEST:
            builder.setStatus(Status.INVALID_ARGUMENT);
            break;
          case HttpStatusCodes.STATUS_CODE_UNAUTHORIZED:
            builder.setStatus(Status.UNAUTHENTICATED);
            break;
          case HttpStatusCodes.STATUS_CODE_FORBIDDEN:
            builder.setStatus(Status.PERMISSION_DENIED);
            break;
          case HttpStatusCodes.STATUS_CODE_NOT_FOUND:
            builder.setStatus(Status.NOT_FOUND);
            break;
          case HttpStatusCodes.STATUS_CODE_PRECONDITION_FAILED:
            builder.setStatus(Status.FAILED_PRECONDITION);
            break;
          case HttpStatusCodes.STATUS_CODE_SERVER_ERROR:
            builder.setStatus(Status.UNAVAILABLE);
            break;
          default:
            builder.setStatus(Status.UNKNOWN);
        }
      } else {
        builder.setStatus(Status.OK);
      }
      return builder.build();
    }
docs: Returns an {@link EndSpanOptions} to end a http span according to the status code.
  
  @param statusCode the status code, can be null to represent no valid response is returned.
  @return an {@code EndSpanOptions} that best suits the status code.