Interface TraceFlagsBuilder


public interface TraceFlagsBuilder
TraceFlagsBuilder is used to construct TraceFlags instances which satisfy the https://www.w3.org/TR/trace-context-2/#trace-flags specification.

This is a simple usage example:


 TraceFlags traceFlags = TraceFlags.builder().setSampled(true).build();
 

Implementation note: no new objects are created by the methods defined by this interface when the default implementation, ImmutableTraceFlags, is used.

Since:
1.60.0
  • Method Details

    • setSampled

      TraceFlagsBuilder setSampled(boolean isSampled)
      Returns an instance of TraceFlagsBuilder which represents a TraceFlags object which has the SAMPLED bit set if the argument is true and the SAMPLED bit cleared when the argument is false. Other bits remain unchanged. The operation does not modify this object.
      Parameters:
      isSampled - the new value for the SAMPLED bit
      Returns:
      a TraceFlagsBuilder object representing the modified TraceFlags
    • setRandomTraceId

      TraceFlagsBuilder setRandomTraceId(boolean isRandomTraceId)
      Returns an instance of TraceFlagsBuilder which represents a TraceFlags object which has the RANDOM_TRACE_ID bit set if the argument is true and the RANDOM_TRACE_ID bit cleared when the argument is false. Other bits remain unchanged. The operation does not modify this object.
      Parameters:
      isRandomTraceId - the new value for the RANDOM_TRACE_ID bit
      Returns:
      a TraceFlagsBuilder object representing the modified TraceFlags
    • build

      TraceFlags build()
      Returns TraceFlags represented by this object.
      Returns:
      a TraceFlags object with the bits set as configured