Class ImmutableSpanContext

java.lang.Object
io.opentelemetry.api.internal.ImmutableSpanContext
All Implemented Interfaces:
SpanContext

@Immutable public abstract class ImmutableSpanContext extends Object implements SpanContext
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
  • Field Details

  • Constructor Details

    • ImmutableSpanContext

      public ImmutableSpanContext()
  • Method Details

    • create

      public static SpanContext create(String traceIdHex, String spanIdHex, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean skipIdValidation)
      Creates a new SpanContext with the given identifiers and options.

      If the traceId or the spanId are invalid (ie. do not conform to the requirements for hexadecimal ids of the appropriate lengths), both will be replaced with the standard "invalid" versions (i.e. all '0's). See SpanId.isValid(CharSequence) and TraceId.isValid(CharSequence) for details.

      Parameters:
      traceIdHex - the trace identifier of the SpanContext.
      spanIdHex - the span identifier of the SpanContext.
      traceFlags - the trace flags of the SpanContext.
      traceState - the trace state for the SpanContext.
      remote - the remote flag for the SpanContext.
      skipIdValidation - pass true to skip validation of trace ID and span ID as an optimization in cases where they are known to have been already validated.
      Returns:
      a new SpanContext with the given identifiers and options.
    • isValid

      public abstract boolean isValid()
      Description copied from interface: SpanContext
      Returns true if this SpanContext is valid.
      Specified by:
      isValid in interface SpanContext
      Returns:
      true if this SpanContext is valid.