- java.lang.Object
-
- brave.propagation.TraceContextOrSamplingFlags
-
public final class TraceContextOrSamplingFlags extends java.lang.ObjectUnion type that contains only one of trace context, trace ID context or sampling flags. This type is designed for use withTracer.nextSpan(TraceContextOrSamplingFlags).Users should not create instances of this, rather use
TraceContext.Extractorprovided by aPropagationimplementation such asPropagation.B3_STRING.Those implementing
Propagationshould use the following advice:- If you have the trace and span ID, use
create(TraceContext) - If you have only a trace ID, use
create(TraceIdContext) - Otherwise, use
create(SamplingFlags)
If your propagation implementation adds extra data, append it via
TraceContextOrSamplingFlags.Builder.addExtra(Object).This started as a port of
com.github.kristofa.brave.TraceData, which served the same purpose.- See Also:
TraceContext.Extractor
- If you have the trace and span ID, use
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTraceContextOrSamplingFlags.Builder
-
Field Summary
Fields Modifier and Type Field Description static TraceContextOrSamplingFlagsDEBUGstatic TraceContextOrSamplingFlagsEMPTYstatic TraceContextOrSamplingFlagsNOT_SAMPLEDstatic TraceContextOrSamplingFlagsSAMPLED
-
Method Summary
-
-
-
Field Detail
-
EMPTY
public static final TraceContextOrSamplingFlags EMPTY
-
NOT_SAMPLED
public static final TraceContextOrSamplingFlags NOT_SAMPLED
-
SAMPLED
public static final TraceContextOrSamplingFlags SAMPLED
-
DEBUG
public static final TraceContextOrSamplingFlags DEBUG
-
-
Method Detail
-
newBuilder
public static TraceContextOrSamplingFlags.Builder newBuilder()
-
sampled
@Nullable public java.lang.Boolean sampled()
ReturnsSamplingFlags.sampled(), regardless of subtype.
-
sampledLocal
public final boolean sampledLocal()
ReturnsSamplingFlags.sampledLocal()}, regardless of subtype.
-
sampled
@Deprecated public TraceContextOrSamplingFlags sampled(@Nullable java.lang.Boolean sampled)
Deprecated.do not use object variant.. only set when you have a sampling decision
-
sampled
public TraceContextOrSamplingFlags sampled(boolean sampled)
-
context
@Nullable public TraceContext context()
-
traceIdContext
@Nullable public TraceIdContext traceIdContext()
-
samplingFlags
@Nullable public SamplingFlags samplingFlags()
-
extra
public final java.util.List<java.lang.Object> extra()
Non-empty whencontext()is null: A list of additional data extracted from the carrier.- See Also:
TraceContext.extra()
-
toBuilder
public final TraceContextOrSamplingFlags.Builder toBuilder()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
create
public static TraceContextOrSamplingFlags create(TraceContext context)
-
create
public static TraceContextOrSamplingFlags create(TraceIdContext traceIdContext)
-
create
public static TraceContextOrSamplingFlags create(SamplingFlags flags)
-
create
public static TraceContextOrSamplingFlags create(@Nullable java.lang.Boolean sampled, boolean debug)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-