Class SamplingFlags

java.lang.Object
brave.propagation.SamplingFlags
Direct Known Subclasses:
TraceContext, TraceIdContext

public class SamplingFlags
extends Object
  • Field Details

  • Method Details

    • sampled

      @Nullable public final Boolean sampled()
      Sampled means send span data to Zipkin (or something else compatible with its data). It is a consistent decision for an entire request (trace-scoped). For example, the value should not move from true to false, even if the decision itself can be deferred.

      Here are the valid options:

      • True means the trace is reported, starting with the first span to set the value true
      • False means the trace should not be reported
      • Null means the decision should be deferred to the next hop

      Once set to true or false, it is expected that this decision is propagated and honored downstream.

      Note: sampling does not imply the trace is invisible to others. For example, a common practice is to generate and propagate identifiers always. This allows other systems, such as logging, to correlate even when the tracing system has no data.

    • sampledLocal

      public final boolean sampledLocal()
      True records this trace locally even if it is not sampled downstream. Defaults to false.

      Note: Setting this does not affect remote sampled status.

      The use case for this is storing data at other sampling rates, or local aggregation of metrics or service aggregations. How to action this data may or may not require inspection of other propagated information.

    • debug

      public final boolean debug()
      True implies sampled(), and is additionally a request to override any storage or collector layer sampling. Defaults to false.
    • toString

      public String toString()
      Overrides:
      toString in class Object