SpanContext class
SpanContext represents Span state that must propagate to descendant Spans and across process boundaries.
SpanContext is logically divided into two pieces: the user-level "Baggage" (see setBaggageItem and getBaggageItem) that propagates across Span boundaries and any Tracer-implementation-specific fields that are needed to identify or otherwise contextualize the associated Span instance (e.g., a <trace_id, span_id, sampled> tuple).
- Implementers
Constructors
- SpanContext({dynamic traceId, dynamic spanId, bool sampled = false})
- Returns a new SpanContext.
Properties
- baggage → Map
-
Baggage is a set of key:value pairs stored in a Span (and its SpanContext)
and propagated in-band to all child Spans and their SpanContexts: in this
way, the “Baggage” travels with the trace, hence the name. Given a
full-stack OpenTracing integration, Baggage enables powerful functionality
by transparently propagating arbitrary application data: for example, an
end-user id may be added as a Baggage item in a mobile app, propagate (via
the distributed tracing machinery) into the depths of a storage system,
and recovered at the bottom of the stack to identify a particularly
expensive SQL query.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampled ↔ bool
-
A SpanContext may optionally indicate if they are sampled or not.
getter/setter pair
- spanId ↔ dynamic
-
Every SpanContext has an associated spanId.
getter/setter pair
- traceId ↔ dynamic
-
Every SpanContext has an associated traceId.
getter/setter pair
Methods
-
forEachBaggageItem(
Function baggageHandler) → void - ForeachBaggageItem grants access to all baggage items stored in the SpanContext. The handler function will be called for each baggage key/value pair. The ordering of items is not guaranteed.
-
getBaggageItem(
dynamic key) → dynamic - Returns the value for a baggage item given its key.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setBaggageItem(
String key, dynamic value) → void - Sets a key:value pair on this SpanContext that also propagates to future children of the associated Span.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited