Class BraveSpanContext

  • All Implemented Interfaces:
    io.opentracing.SpanContext

    public abstract class BraveSpanContext
    extends 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 Detail

      • 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 Iterable<Map.Entry<String,​String>> baggageItems()
        Returns empty unless BaggagePropagation is in use
        Specified by:
        baggageItems in interface io.opentracing.SpanContext