Propagator - TextFormatPropagator

class opencensus.trace.propagation.text_format.TextFormatPropagator[source]

Bases: object

This class provides the basic utilities for extracting the trace information from a carrier which is a dict to form a SpanContext. And generating a dict using the provided SpanContext.

from_carrier(carrier)[source]

Generate a SpanContext object using the information in the carrier.

Parameters

carrier (dict) -- The carrier which has the trace_id, span_id, options information for creating a SpanContext.

Return type

SpanContext

Returns

SpanContext generated from the carrier.

to_carrier(span_context, carrier)[source]

Inject the SpanContext fields to carrier dict.

Parameters
  • span_context (SpanContext) -- SpanContext object.

  • carrier (dict) -- The carrier which holds the trace_id, span_id, options information from a SpanContext.

Return type

dict

Returns

The carrier which holds the span context information.