Class TraceState


  • @Immutable
    public abstract class TraceState
    extends Object
    Carries tracing-system specific context in a list of key-value pairs. TraceState allows different vendors propagate additional information and inter-operate with their legacy Id formats.

    Implementation is optimized for a small list of key-value pairs.

    Key is opaque string up to 256 characters printable. It MUST begin with a lowercase letter, and can only contain lowercase letters a-z, digits 0-9, underscores _, dashes -, asterisks *, and forward slashes /.

    Value is opaque string up to 256 characters printable ASCII RFC0020 characters (i.e., the range 0x20 to 0x7E) except comma , and =.

    • Method Detail

      • getDefault

        public static TraceState getDefault()
        Returns the default TraceState with no entries.
        Returns:
        the default TraceState.
      • get

        @Nullable
        public String get​(String key)
        Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
        Parameters:
        key - with which the specified value is to be associated
        Returns:
        the value to which the specified key is mapped, or null if this map contains no mapping for the key.
      • size

        public int size()
        Returns the number of entries in this TraceState.
      • isEmpty

        public boolean isEmpty()
        Returns whether this TraceState is empty, containing no entries.
      • builder

        public static TraceState.Builder builder()
        Returns a Builder based on an empty TraceState.
        Returns:
        a Builder based on an empty TraceState.
      • toBuilder

        public TraceState.Builder toBuilder()
        Returns a Builder based on this TraceState.
        Returns:
        a Builder based on this TraceState.