Interface SingleLineValue


  • public interface SingleLineValue
    Wrapper for supporting injecting and extracting single-string values.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static java.lang.String format​(long traceId, long spanId, java.lang.Long parentSpanId)
      Formats the provided trace information.
      static java.lang.String format​(java.lang.String traceIdHex, java.lang.String spanIdHex, java.lang.String parentSpanIdHex)
      Formats the provided trace information.
      static java.lang.String format​(java.lang.String traceIdHex, java.lang.String spanIdHex, java.lang.String parentSpanIdHex, boolean isSampled)
      Formats the provided trace information.
      java.lang.String get()
      Gets the value.
      static SingleLineValue of​(java.lang.String value)
      Returns a SingleLineValue backed by a fixed string.
      void set​(java.lang.String value)
      Sets the value.
      static SingleLineValue to​(java.util.function.Consumer<java.lang.String> consumer)
      Returns a SingleLineValue which supports injection.
    • Method Detail

      • get

        @Nullable
        java.lang.String get()
        Gets the value.
        Returns:
        the value
      • set

        void set​(java.lang.String value)
        Sets the value.
        Parameters:
        value - the value
      • to

        static SingleLineValue to​(java.util.function.Consumer<java.lang.String> consumer)
        Returns a SingleLineValue which supports injection.
        Parameters:
        consumer - consumer to call when a value is injected
        Returns:
        a write-only SingleLineValue
      • format

        static java.lang.String format​(long traceId,
                                       long spanId,
                                       @Nullable
                                       java.lang.Long parentSpanId)
        Formats the provided trace information.
        Parameters:
        traceId - the trace ID.
        spanId - the span ID.
        parentSpanId - the parent span ID, or null if none available.
        Returns:
        the formatted trace information as String.
      • format

        static java.lang.String format​(java.lang.String traceIdHex,
                                       java.lang.String spanIdHex,
                                       @Nullable
                                       java.lang.String parentSpanIdHex)
        Formats the provided trace information.
        Parameters:
        traceIdHex - the trace ID as HEX String.
        spanIdHex - the span ID as HEX String.
        parentSpanIdHex - the parent span ID as HEX String, or null if none available.
        Returns:
        the formatted trace information as String.
      • format

        static java.lang.String format​(java.lang.String traceIdHex,
                                       java.lang.String spanIdHex,
                                       @Nullable
                                       java.lang.String parentSpanIdHex,
                                       boolean isSampled)
        Formats the provided trace information.
        Parameters:
        traceIdHex - the trace ID as HEX String.
        spanIdHex - the span ID as HEX String.
        parentSpanIdHex - the parent span ID as HEX String, or null if none available.
        isSampled - true if the span is sampled.
        Returns:
        the formatted trace information as String.