Package brave.propagation
Class SamplingFlags
- java.lang.Object
-
- brave.propagation.SamplingFlags
-
- Direct Known Subclasses:
TraceContext
,TraceIdContext
public class SamplingFlags extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SamplingFlags.Builder
Deprecated.prefer using constants.
-
Field Summary
Fields Modifier and Type Field Description static SamplingFlags
DEBUG
static SamplingFlags
EMPTY
static SamplingFlags
NOT_SAMPLED
static SamplingFlags
SAMPLED
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
debug()
True impliessampled()
, and is additionally a request to override any storage or collector layer sampling.Boolean
sampled()
Sampled means send span data to Zipkin (or something else compatible with its data).boolean
sampledLocal()
True records this trace locally even if it is notsampled downstream
.String
toString()
-
-
-
Field Detail
-
EMPTY
public static final SamplingFlags EMPTY
-
NOT_SAMPLED
public static final SamplingFlags NOT_SAMPLED
-
SAMPLED
public static final SamplingFlags SAMPLED
-
DEBUG
public static final SamplingFlags DEBUG
-
-
Method Detail
-
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 notsampled 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 impliessampled()
, and is additionally a request to override any storage or collector layer sampling. Defaults to false.
-
-