public abstract class TraceContext extends SamplingFlags
Particularly, this includes trace identifiers and sampled state.
The implementation was originally com.github.kristofa.brave.SpanId
, which was a
port of com.twitter.finagle.tracing.TraceId
. Unlike these mentioned, this type does not
expose a single binary representation. That's because propagation forms can now vary.
Modifier and Type | Class | Description |
---|---|---|
static class |
TraceContext.Builder |
|
static interface |
TraceContext.Extractor<C> |
Used to join an incoming trace.
|
static interface |
TraceContext.Injector<C> |
Used to send the trace context downstream.
|
DEBUG, EMPTY, NOT_SAMPLED, SAMPLED
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object o) |
|
abstract List<Object> |
extra() |
Returns a list of additional data propagated through this trace.
|
int |
hashCode() |
|
static TraceContext.Builder |
newBuilder() |
|
abstract Long |
parentId() |
The parent's
spanId() or null if this the root span in a trace. |
abstract Boolean |
sampled() |
Should we sample this request or not? True means sample, false means don't, null means we defer
decision to someone further down in the stack.
|
abstract boolean |
shared() |
True if we are contributing to a span started by another tracer (ex on a different host).
|
abstract long |
spanId() |
Unique 8-byte identifier of this span within a trace.
|
abstract TraceContext.Builder |
toBuilder() |
|
String |
toString() |
Returns
$traceId/$spanId |
abstract long |
traceId() |
Unique 8-byte identifier for a trace, set on all spans within it.
|
abstract long |
traceIdHigh() |
When non-zero, the trace containing this span uses 128-bit trace identifiers.
|
String |
traceIdString() |
Returns the hex representation of the span's trace ID
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
debug
public static TraceContext.Builder newBuilder()
public abstract long traceIdHigh()
public abstract long traceId()
@Nullable public abstract Long parentId()
spanId()
or null if this the root span in a trace.@Nullable public abstract Boolean sampled()
SamplingFlags
sampled
in class SamplingFlags
public abstract long spanId()
public abstract boolean shared()
When an RPC trace is client-originated, it will be sampled and the same span ID is used for the server side. However, the server shouldn't set span.timestamp or duration since it didn't start the span.
public abstract List<Object> extra()
The contents are intentionally opaque, deferring to Propagation to define. An example implementation could be storing a class containing a correlation value, which is extracted from incoming requests and injected as-is onto outgoing requests.
public abstract TraceContext.Builder toBuilder()
public String traceIdString()
Copyright © 2017 OpenZipkin. All rights reserved.