@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, as well as the traceState and the remote
flag.| Constructor and Description |
|---|
SpanContext() |
| Modifier and Type | Method and Description |
|---|---|
static SpanContext |
create(TraceId traceId,
SpanId spanId,
TraceFlags traceFlags,
TraceState traceState)
Creates a new
SpanContext with the given identifiers and options. |
static SpanContext |
createFromRemoteParent(TraceId traceId,
SpanId spanId,
TraceFlags 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. |
abstract SpanId |
getSpanId()
Returns the span identifier associated with this
SpanContext. |
abstract TraceFlags |
getTraceFlags()
Returns the
TraceFlags associated with this SpanContext. |
abstract TraceId |
getTraceId()
Returns 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 |
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(TraceId traceId, SpanId spanId, TraceFlags traceFlags, TraceState traceState)
SpanContext with the given identifiers and options.traceId - the trace identifier of the span context.spanId - the span identifier of the span context.traceFlags - the trace options for the span context.traceState - the trace state for the span context.SpanContext with the given identifiers and options.public static SpanContext createFromRemoteParent(TraceId traceId, SpanId spanId, TraceFlags traceFlags, TraceState traceState)
SpanContext that was propagated from a remote parent, with the given
identifiers and options.traceId - the trace identifier of the span context.spanId - the span identifier of the span context.traceFlags - the trace options for the span context.traceState - the trace state for the span context.SpanContext with the given identifiers and options.public abstract TraceId getTraceId()
SpanContext.SpanContext.public abstract SpanId getSpanId()
SpanContext.SpanContext.public abstract TraceFlags getTraceFlags()
TraceFlags associated with this SpanContext.TraceFlags associated with this SpanContext.public abstract TraceState getTraceState()
TraceState associated with this SpanContext.TraceState associated with this SpanContext.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.