@Immutable
public abstract class SpanContext
extends java.lang.Object
Span
s and across process boundaries. It contains the identifiers (a trace_id
and span_id
) associated with the Span
and a set of options
(currently only whether the context is sampled or not), as well as the traceState
and the remote
flag.Constructor and Description |
---|
SpanContext() |
Modifier and Type | Method and Description |
---|---|
void |
copyTraceFlagsHexTo(char[] dest,
int destOffset) |
static SpanContext |
create(java.lang.String traceIdHex,
java.lang.String spanIdHex,
byte traceFlags,
TraceState traceState)
Creates a new
SpanContext with the given identifiers and options. |
static SpanContext |
createFromRemoteParent(java.lang.String traceIdHex,
java.lang.String spanIdHex,
byte traceFlags,
TraceState traceState)
Creates a new
SpanContext that was propagated from a remote parent, with the given
identifiers and options. |
static SpanContext |
getInvalid()
Returns the invalid
SpanContext that can be used for no-op operations. |
java.lang.String |
getSpanIdAsHexString()
Returns the span identifier associated with this
SpanContext . |
byte[] |
getSpanIdBytes()
Returns the byte[] representation of the span identifier associated with this
SpanContext . |
abstract byte |
getTraceFlags()
The byte-representation of
TraceFlags . |
java.lang.String |
getTraceIdAsHexString()
Returns the trace identifier associated with this
SpanContext . |
byte[] |
getTraceIdBytes()
Returns the byte[] representation of the trace identifier associated with this
SpanContext . |
abstract TraceState |
getTraceState()
Returns the
TraceState associated with this SpanContext . |
abstract boolean |
isRemote()
Returns
true if the SpanContext was propagated from a remote parent. |
boolean |
isSampled()
Whether the span in this context is sampled.
|
boolean |
isValid()
Returns
true if this SpanContext is valid. |
public static SpanContext getInvalid()
SpanContext
that can be used for no-op operations.SpanContext
.public static SpanContext create(java.lang.String traceIdHex, java.lang.String spanIdHex, byte traceFlags, TraceState traceState)
SpanContext
with the given identifiers and options.traceIdHex
- the trace identifier of the span context.spanIdHex
- the span identifier of the span context.traceFlags
- the byte representation of the TraceFlags
traceState
- the trace state for the span context.SpanContext
with the given identifiers and options.public static SpanContext createFromRemoteParent(java.lang.String traceIdHex, java.lang.String spanIdHex, byte traceFlags, TraceState traceState)
SpanContext
that was propagated from a remote parent, with the given
identifiers and options.traceIdHex
- the trace identifier of the span context.spanIdHex
- the span identifier of the span context.traceFlags
- the byte representation of the TraceFlags
traceState
- the trace state for the span context.SpanContext
with the given identifiers and options.public java.lang.String getTraceIdAsHexString()
SpanContext
.SpanContext
.@Memoized public byte[] getTraceIdBytes()
SpanContext
.public java.lang.String getSpanIdAsHexString()
SpanContext
.SpanContext
.@Memoized public byte[] getSpanIdBytes()
SpanContext
.public boolean isSampled()
public abstract byte getTraceFlags()
TraceFlags
.public void copyTraceFlagsHexTo(char[] dest, int destOffset)
public abstract TraceState getTraceState()
TraceState
associated with this SpanContext
.TraceState
associated with this SpanContext
.@Memoized public boolean isValid()
true
if this SpanContext
is valid.true
if this SpanContext
is valid.public abstract boolean isRemote()
true
if the SpanContext
was propagated from a remote parent.true
if the SpanContext
was propagated from a remote parent.