Class DD64bTraceId

java.lang.Object
datadog.trace.api.DDTraceId
datadog.trace.api.DD64bTraceId

public class DD64bTraceId extends DDTraceId
Class encapsulating the unsigned 64 bit id used for Traceids.

It contains generation of new ids, parsing, and to string for both decimal and hex representations. The decimal string representation is either kept from parsing, or generated on demand and cached.

  • Field Details

  • Method Details

    • from

      public static DD64bTraceId from(long id)
      Create a new DD64bTraceId from the given long interpreted as the bits of the unsigned 64-bit id. This means that values larger than Long.MAX_VALUE will be represented as negative numbers.
      Parameters:
      id - The long representing the bits of the unsigned 64-bit id.
      Returns:
      A new DD64bTraceId instance.
    • from

      public static DD64bTraceId from(String s) throws NumberFormatException
      Create a new DDTraceId from the given String representation of the unsigned 64 bit id.
      Parameters:
      s - String of unsigned 64 bit id
      Returns:
      DDTraceId
      Throws:
      NumberFormatException
    • fromHex

      public static DD64bTraceId fromHex(String s) throws NumberFormatException
      Create a new DDTraceId from the given String hex representation of the unsigned 64 bit id.
      Parameters:
      s - String in hex of unsigned 64 bit id
      Returns:
      DDTraceId
      Throws:
      NumberFormatException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Description copied from class: DDTraceId
      Returns a 64-bit only decimal String representation of the DDTraceId. The String will be cached.
      Specified by:
      toString in class DDTraceId
      Returns:
      A cached 64-bit only decimal String representation of the DDTraceId instance.
    • toHexString

      public String toHexString()
      Description copied from class: DDTraceId
      Returns the lower-case zero-padded 32 hexadecimal characters String representation of the DDTraceId. The * String will be cached.
      Specified by:
      toHexString in class DDTraceId
      Returns:
      A cached lower-case zero-padded 32 hexadecimal characters String representation of the DDTraceId instance.
    • toHexStringPadded

      public String toHexStringPadded(int size)
      Description copied from class: DDTraceId
      Returns the lower-case zero-padded hexadecimal String representation of the DDTraceId. The size will be rounded up to 16 or 32 characters. This hexadecimal String will not be cached.
      Specified by:
      toHexStringPadded in class DDTraceId
      Parameters:
      size - The size in characters of the zero-padded String (rounded up to 16 or 32).
      Returns:
      A lower-case zero-padded String representation representation of the DDTraceId instance.
    • toLong

      public long toLong()
      Description copied from class: DDTraceId
      Returns the low-order 64 bits of the DDTraceId as an unsigned long. This means that values larger than Long.MAX_VALUE will be represented as negative numbers.
      Specified by:
      toLong in class DDTraceId
      Returns:
      The low-order 64 bits of the DDTraceId as an unsigned long.
    • toHighOrderLong

      public long toHighOrderLong()
      Description copied from class: DDTraceId
      Returns the high-order 64 bits of 128-bit DDTraceId as un unsigned long. This means that values larger than Long.MAX_VALUE will be represented as negative numbers.
      Specified by:
      toHighOrderLong in class DDTraceId
      Returns:
      The high-order 64 bits of the 128-bit DDTraceId as an unsigned long, 0 for 64-bit DDTraceId only.