Class DDSpanId

java.lang.Object
datadog.trace.api.DDSpanId

public final class DDSpanId extends Object
Class with methods for working with the unsigned 64 bit id used for Span ids.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static final long
    The ZERO span id is not allowed and means no span.
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    Parse the span id from the given String representation of the unsigned 64 bit id.
    static long
    Parse the span id from the given String hex representation of the unsigned 64 bit id.
    static long
    fromHex(String s, int start, int len, boolean lowerCaseOnly)
    Parse the span id from the given String hex representation of the unsigned 64 bit id.
    static String
    toHexString(long id)
    Returns the no zero padded hex representation, in lower case, of the unsigned 64 bit id.
    static String
    Returns the zero padded hex representation, in lower case, of the unsigned 64 bit id.
    static String
    toString(long id)
    Returns the decimal string representation of the unsigned 64 bit id.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • from

      public static long from(String s) throws NumberFormatException
      Parse the span id from the given String representation of the unsigned 64 bit id.
      Parameters:
      s - String of unsigned 64 bit id
      Returns:
      long
      Throws:
      NumberFormatException
    • fromHex

      public static long fromHex(String s) throws NumberFormatException
      Parse the span id from the given String hex representation of the unsigned 64 bit id.
      Parameters:
      s - String in hex of unsigned 64 bit id
      Returns:
      long
      Throws:
      NumberFormatException
    • fromHex

      public static long fromHex(String s, int start, int len, boolean lowerCaseOnly) throws NumberFormatException
      Parse the span id from the given String hex representation of the unsigned 64 bit id.
      Parameters:
      s - String in hex of unsigned 64 bit id
      start - the start index of the hex value
      len - the len of the hex value
      lowerCaseOnly - if the allowed hex characters are lower case only
      Returns:
      long
      Throws:
      NumberFormatException
    • toString

      public static String toString(long id)
      Returns the decimal string representation of the unsigned 64 bit id. The String will NOT be cached.
      Parameters:
      id - the long 64 bit id to generate a String for
      Returns:
      decimal string
    • toHexString

      public static String toHexString(long id)
      Returns the no zero padded hex representation, in lower case, of the unsigned 64 bit id. The hex String will NOT be cached.
      Returns:
      non zero padded hex String
    • toHexStringPadded

      public static String toHexStringPadded(long id)
      Returns the zero padded hex representation, in lower case, of the unsigned 64 bit id. The size will be rounded up to 16 characters. The hex String will NOT be cached.
      Returns:
      zero padded hex String