Class BraveSpanContext

java.lang.Object
brave.opentracing.BraveSpanContext
All Implemented Interfaces:
io.opentracing.SpanContext

public abstract class BraveSpanContext
extends java.lang.Object
implements io.opentracing.SpanContext
Holds the TraceContext used by the underlying Tracer, or an {link TraceContextOrSamplingFlags extraction result if an incoming context}. An unsampled context results in a noop span.

This type also includes hooks to integrate with the underlying Tracer. Ex you can access the underlying trace context with unwrap()

  • Method Summary

    Modifier and Type Method Description
    abstract java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.String>> baggageItems()
    Returns empty unless BaggagePropagation is in use
    abstract brave.propagation.TraceContext unwrap()
    Returns the underlying trace context for use in Brave apis, or null if this object does not represent a span.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.opentracing.SpanContext

    toSpanId, toTraceId
  • Method Details

    • unwrap

      public abstract brave.propagation.TraceContext unwrap()
      Returns the underlying trace context for use in Brave apis, or null if this object does not represent a span.

      When a span context is returned from BraveSpan.context(), there's no ambiguity. It represents the current span. However, a span context can be in an intermediate state when extracted from headers. In other words, unwrap might not have a TraceContext to return.

      Why? Extraction from headers can return partial info. For example, in Amazon Web Services, you may be suggested just a trace ID. In other cases, you might just inherit baggage or a sampling hint.

    • baggageItems

      public abstract java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.String>> baggageItems()
      Returns empty unless BaggagePropagation is in use
      Specified by:
      baggageItems in interface io.opentracing.SpanContext