Interface SpanContext


public interface SpanContext
Context of a tracing Span.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    asParent(Span.Builder<?> spanBuilder)
    Configure this context as a parent of the provided builder.
    Returns the baggage extractable from the span context.
    default boolean
    Whether the associated span is sampled.
    Span ID of the associated span.
    Trace ID of the associated span.
  • Method Details

    • traceId

      String traceId()
      Trace ID of the associated span.
      Returns:
      trace id
    • spanId

      String spanId()
      Span ID of the associated span.
      Returns:
      span id
    • sampled

      default boolean sampled()
      Whether the associated span is sampled. Implementations should override this method to report the tracer's sampling decision. The default returns true for compatibility with existing implementations.
      Returns:
      whether the span is sampled
    • asParent

      void asParent(Span.Builder<?> spanBuilder)
      Configure this context as a parent of the provided builder.
      Parameters:
      spanBuilder - span builder to update, it will be a child of this span context
    • baggage

      Baggage baggage()
      Returns the baggage extractable from the span context.
      Returns:
      Baggage instance; empty if no baggage is available from the span context