Span Context¶
SpanContext encapsulates the current context within the request's trace.
-
class
opencensus.trace.span_context.
SpanContext
(trace_id=None, span_id=None, trace_options=None, tracestate=None, from_header=False)[source]¶ Bases:
object
SpanContext includes 3 fields: traceId, spanId, and an trace_options flag which indicates whether or not the request is being traced. It contains the current context to be propagated to the child spans.
- Parameters
trace_id (str) -- (Optional) Trace_id is a 32 digits uuid for the trace. If not given, will generate one automatically.
span_id (str) -- (Optional) Identifier for the span, unique within a trace. If not given, will generate one automatically.
trace_options -- (Optional) TraceOptions indicates 8 trace options.
from_header (bool) -- (Optional) Indicates whether the trace context is generated from request header.