@Immutable public abstract class SpanContext extends Object
Spans 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(String traceIdHex,
String spanIdHex,
byte traceFlags,
TraceState traceState)
Creates a new
SpanContext with the given identifiers and options. |
static SpanContext |
createFromRemoteParent(String traceIdHex,
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. |
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. |
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(String traceIdHex, 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 TraceFlagstraceState - the trace state for the span context.SpanContext with the given identifiers and options.public static SpanContext createFromRemoteParent(String traceIdHex, 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 TraceFlagstraceState - the trace state for the span context.SpanContext with the given identifiers and options.public String getTraceIdAsHexString()
SpanContext.SpanContext.@Memoized public byte[] getTraceIdBytes()
SpanContext.public 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.