Package 

Class DD128bTraceId


  • 
    public class DD128bTraceId
    extends DDTraceId
                        

    Class encapsulating the unsigned 128-bit id used for TraceIds.

    It contains parsing and formatting to string for both decimal and hexadecimal representations. The string representations are either kept from parsing, or generated on demand and cached.

    DD128bTraceId can represent either a 128-bit TraceId or a 64-bit TraceId. For 128-bit TraceId, highOrderBits contains a 32-bit timestamp store on the 32 higher bits and lowOrderBits contains a unique and random 64-bit id. For 64-bit TraceId, is set to 0 and lowOrderBits contains a unique and random 63-bit id.

    • Method Detail

      • from

         static DD128bTraceId from(long highOrderBits, long lowOrderBits)

        Create a new 128-bit DD128bTraceId from the given {@code long}s interpreted as highorder and low order bits of the 128-bit id.

        Parameters:
        highOrderBits - A {@code long} representing the high-order bits of the .
        lowOrderBits - A {@code long} representing the random id low-order bits.
      • fromHex

         static DD128bTraceId fromHex(String s, int start, int length, boolean lowerCaseOnly)

        Create a new 128-bit DD128bTraceId from the given hexadecimal String representation.

        Parameters:
        s - The string containing the hexadecimal String representation to parse (32 loweror higher-case hexadecimal characters maximum).
        start - The start index of the hexadecimal String representation to parse.
        length - The length of the hexadecimal String representation to parse.
        lowerCaseOnly - Whether the hexadecimal characters to parse are lower-case only or not.
      • toHexStringPadded

         String toHexStringPadded(int size)

        Returns the lower-case zero-padded hexadecimal String representation ofthe DDTraceId. The size will be rounded up to 16 or 32characters. This hexadecimal Stringwill not be cached.

        Parameters:
        size - The size in characters of the zero-padded String (rounded up to 16 or 32).
      • toLong

         long toLong()

        Returns the low-order 64 bits of the DDTraceId as an unsigned {@code long}. This meansthat values larger than MAX_VALUE will be represented as negative numbers.

      • toHighOrderLong

         long toHighOrderLong()

        Returns the high-order 64 bits of 128-bit DDTraceId as un unsigned {@code long}. Thismeans that values larger than MAX_VALUE will be represented as negative numbers.