Class Traceparent
java.lang.Object
org.projecthusky.communication.utils.Traceparent
A class representing a traceparent.
The traceId value is managed in the same way as UUID.
- Author:
- Quentin Ligier
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTraceparent(byte version, long traceIdMostSigBits, long traceIdLeastSigBits, long parentId, byte flags) Creates a new traceparent. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintflags()inthashCode()parentId()static TraceparentParses a traceparent from a string.static Traceparentrandom()Generates a random traceparent, with version 0 and flags 0.toString()Returns the string representation of this traceparent.traceId()intversion()Duplicates this instance with the given flags.withParentId(String parentId) Duplicates this instance with the given parent id.Duplicates this instance with a random parent id.withTraceId(String traceId) Duplicates this instance with the given trace id.withVersion(String version) Duplicates this instance with the given version.
-
Constructor Details
-
Traceparent
public Traceparent(byte version, long traceIdMostSigBits, long traceIdLeastSigBits, long parentId, byte flags) Creates a new traceparent.- Parameters:
version- The version of the traceparent. 8-bit unsigned integer. Version ff is invalid.traceIdMostSigBits- The most significant bits of the traceId. 8-byte unsigned integer.traceIdLeastSigBits- The least significant bits of the traceId. 8-byte unsigned integer.parentId- The parent id. 8-byte unsigned integer.flags- The flags. 8-bit unsigned integer.
-
-
Method Details
-
random
Generates a random traceparent, with version 0 and flags 0. -
parse
Parses a traceparent from a string. -
version
public int version() -
traceId
-
parentId
-
flags
public int flags() -
toString
Returns the string representation of this traceparent. -
withVersion
Duplicates this instance with the given version. -
withTraceId
Duplicates this instance with the given trace id. -
withParentId
Duplicates this instance with the given parent id. -
withFlags
Duplicates this instance with the given flags. -
withRandomParentId
Duplicates this instance with a random parent id. -
equals
-
hashCode
public int hashCode()
-