Package io.opencensus.trace
Class Status
- java.lang.Object
-
- io.opencensus.trace.Status
-
@Immutable public final class Status extends java.lang.ObjectDefines the status of aSpanby providing a standardStatus.CanonicalCodein conjunction with an optional descriptive message. Instances ofStatusare created by starting with the template for the appropriateStatus.CanonicalCodeand supplementing it with additional information:Status.NOT_FOUND.withDescription("Could not find 'important_file.txt'");- Since:
- 0.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStatus.CanonicalCodeThe set of canonical status codes.
-
Field Summary
Fields Modifier and Type Field Description static StatusABORTEDThe operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.static StatusALREADY_EXISTSSome entity that we attempted to create (e.g., file or directory) already exists.static StatusCANCELLEDThe operation was cancelled (typically by the caller).private Status.CanonicalCodecanonicalCodestatic StatusDATA_LOSSUnrecoverable data loss or corruption.static StatusDEADLINE_EXCEEDEDDeadline expired before operation could complete.private java.lang.Stringdescriptionstatic StatusFAILED_PRECONDITIONOperation was rejected because the system is not in a state required for the operation's execution.static StatusINTERNALInternal errors.static StatusINVALID_ARGUMENTClient specified an invalid argument.static StatusNOT_FOUNDSome requested entity (e.g., file or directory) was not found.static StatusOKThe operation completed successfully.static StatusOUT_OF_RANGEOperation was attempted past the valid range.static StatusPERMISSION_DENIEDThe caller does not have permission to execute the specified operation.static StatusRESOURCE_EXHAUSTEDSome resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.private static java.util.List<Status>STATUS_LISTstatic StatusUNAUTHENTICATEDThe request does not have valid authentication credentials for the operation.static StatusUNAVAILABLEThe service is currently unavailable.static StatusUNIMPLEMENTEDOperation is not implemented or not supported/enabled in this service.static StatusUNKNOWNUnknown error.
-
Constructor Summary
Constructors Modifier Constructor Description privateStatus(Status.CanonicalCode canonicalCode, java.lang.String description)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.List<Status>buildStatusList()booleanequals(java.lang.Object obj)Equality on Statuses is not well defined.Status.CanonicalCodegetCanonicalCode()Returns the canonical status code.java.lang.StringgetDescription()Returns the description of thisStatusfor human consumption.inthashCode()Hash codes on Statuses are not well defined.booleanisOk()Returnstrueif thisStatusis OK, i.e., not an error.java.lang.StringtoString()StatuswithDescription(java.lang.String description)Creates a derived instance ofStatuswith the given description.
-
-
-
Field Detail
-
STATUS_LIST
private static final java.util.List<Status> STATUS_LIST
-
OK
public static final Status OK
The operation completed successfully.- Since:
- 0.5
-
CANCELLED
public static final Status CANCELLED
The operation was cancelled (typically by the caller).- Since:
- 0.5
-
UNKNOWN
public static final Status UNKNOWN
Unknown error. SeeStatus.CanonicalCode.UNKNOWN.- Since:
- 0.5
-
INVALID_ARGUMENT
public static final Status INVALID_ARGUMENT
Client specified an invalid argument. SeeStatus.CanonicalCode.INVALID_ARGUMENT.- Since:
- 0.5
-
DEADLINE_EXCEEDED
public static final Status DEADLINE_EXCEEDED
Deadline expired before operation could complete. SeeStatus.CanonicalCode.DEADLINE_EXCEEDED.- Since:
- 0.5
-
NOT_FOUND
public static final Status NOT_FOUND
Some requested entity (e.g., file or directory) was not found.- Since:
- 0.5
-
ALREADY_EXISTS
public static final Status ALREADY_EXISTS
Some entity that we attempted to create (e.g., file or directory) already exists.- Since:
- 0.5
-
PERMISSION_DENIED
public static final Status PERMISSION_DENIED
The caller does not have permission to execute the specified operation. SeeStatus.CanonicalCode.PERMISSION_DENIED.- Since:
- 0.5
-
UNAUTHENTICATED
public static final Status UNAUTHENTICATED
The request does not have valid authentication credentials for the operation.- Since:
- 0.5
-
RESOURCE_EXHAUSTED
public static final Status RESOURCE_EXHAUSTED
Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.- Since:
- 0.5
-
FAILED_PRECONDITION
public static final Status FAILED_PRECONDITION
Operation was rejected because the system is not in a state required for the operation's execution. SeeStatus.CanonicalCode.FAILED_PRECONDITION.- Since:
- 0.5
-
ABORTED
public static final Status ABORTED
The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc. SeeStatus.CanonicalCode.ABORTED.- Since:
- 0.5
-
OUT_OF_RANGE
public static final Status OUT_OF_RANGE
Operation was attempted past the valid range. SeeStatus.CanonicalCode.OUT_OF_RANGE.- Since:
- 0.5
-
UNIMPLEMENTED
public static final Status UNIMPLEMENTED
Operation is not implemented or not supported/enabled in this service.- Since:
- 0.5
-
INTERNAL
public static final Status INTERNAL
Internal errors. SeeStatus.CanonicalCode.INTERNAL.- Since:
- 0.5
-
UNAVAILABLE
public static final Status UNAVAILABLE
The service is currently unavailable. SeeStatus.CanonicalCode.UNAVAILABLE.- Since:
- 0.5
-
DATA_LOSS
public static final Status DATA_LOSS
Unrecoverable data loss or corruption.- Since:
- 0.5
-
canonicalCode
private final Status.CanonicalCode canonicalCode
-
description
@Nullable private final java.lang.String description
-
-
Constructor Detail
-
Status
private Status(Status.CanonicalCode canonicalCode, @Nullable java.lang.String description)
-
-
Method Detail
-
buildStatusList
private static java.util.List<Status> buildStatusList()
-
withDescription
public Status withDescription(@Nullable java.lang.String description)
Creates a derived instance ofStatuswith the given description.- Parameters:
description- the new description of theStatus.- Returns:
- The newly created
Statuswith the given description. - Since:
- 0.5
-
getCanonicalCode
public Status.CanonicalCode getCanonicalCode()
Returns the canonical status code.- Returns:
- the canonical status code.
- Since:
- 0.5
-
getDescription
@Nullable public java.lang.String getDescription()
Returns the description of thisStatusfor human consumption.- Returns:
- the description of this
Status. - Since:
- 0.5
-
isOk
public boolean isOk()
Returnstrueif thisStatusis OK, i.e., not an error.- Returns:
trueif thisStatusis OK.- Since:
- 0.5
-
equals
public boolean equals(@Nullable java.lang.Object obj)Equality on Statuses is not well defined. Instead, do comparison based on their CanonicalCode withgetCanonicalCode(). The description of the Status is unlikely to be stable, and additional fields may be added to Status in the future.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Hash codes on Statuses are not well defined.- Overrides:
hashCodein classjava.lang.Object- See Also:
equals(java.lang.Object)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-