| 构造器 | 说明 |
|---|---|
HiTraceId() |
A constructor used to create an
HiTraceId object. |
HiTraceId(byte[] idArray) |
Generates a
HiTraceId object based on idArray. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
long |
getChainId() |
Obtains the call chain ID from a
HiTraceId object. |
long |
getParentSpanId() |
Obtains the parent span ID from a
HiTraceId object. |
long |
getSpanId() |
Obtains the span ID from a
HiTraceId object. |
boolean |
isValid() |
Checks whether an
HiTraceId object is valid. |
void |
setChainId(long chainId) |
Sets the chain ID for the current trace ID.
|
void |
setParentSpanId(long parentSpanId) |
Sets the parent span ID for the current trace ID.
|
void |
setSpanId(long spanId) |
Sets the span ID for the current trace ID.
|
byte[] |
toBytes() |
Converts a
HiTraceId object to an idArray. |
public HiTraceId()
HiTraceId object.
An invalid, initial object is generated.
public HiTraceId(byte[] idArray)
HiTraceId object based on idArray.idArray - Indicates a byte array, which is converted from another HiTraceId object by using the toBytes method.toBytes()public boolean isValid()
HiTraceId object is valid.true if the HiTraceId object is valid; returns false otherwise.public long getChainId()
HiTraceId object.HiTraceId object is valid; returns 0 otherwise.public void setChainId(long chainId)
If the current trace ID is invalid, change it to a valid one.
chainId - Indicates the chain ID to set.public long getSpanId()
HiTraceId object.HiTraceId object is valid; returns 0 otherwise.public void setSpanId(long spanId)
If the current trace ID is invalid, nothing will be done.
spanId - Indicates the span ID to set.public long getParentSpanId()
HiTraceId object.HiTraceId object is valid; returns 0 otherwise.public void setParentSpanId(long parentSpanId)
If the current trace ID is invalid, nothing will be done.
parentSpanId - Indicates the parent span ID to set.public byte[] toBytes()
HiTraceId object to an idArray.idArray object if the HiTraceId object is valid;
returns an invalid idArray object otherwise.