This repository was archived by the owner on Sep 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,8 +169,8 @@ Propagators
169169~~~~~~~~~~~
170170
171171You can specify the propagator type for serializing and deserializing the
172- ``SpanContext `` and its headers. There are currently two built in propagators:
173- ``GoogleCloudFormatPropagator `` and ``TextFormatPropagator ``.
172+ ``SpanContext `` and its headers. There are currently three built in propagators:
173+ ``GoogleCloudFormatPropagator ``, `` TextFormatPropagator `` and ``TraceContextPropagator ``.
174174
175175This example shows how to use the ``GoogleCloudFormatPropagator ``:
176176
@@ -186,6 +186,23 @@ This example shows how to use the ``GoogleCloudFormatPropagator``:
186186 # Serialize
187187 header = propagator.to_header(span_context)
188188
189+ This example shows how to use the ``TraceContextPropagator ``:
190+
191+ .. code :: python
192+
193+ import requests
194+
195+ from opencensus.trace import config_integration
196+ from opencensus.trace.propagation.trace_context_http_header_format import TraceContextPropagator
197+ from opencensus.trace.tracer import Tracer
198+
199+ config_integration.trace_integrations([' httplib' ])
200+ tracer = Tracer(propagator = TraceContextPropagator())
201+
202+ with tracer.span(name = ' parent' ):
203+ with tracer.span(name = ' child' ):
204+ response = requests.get(' http://localhost:5000' )
205+
189206 Blacklist Paths
190207~~~~~~~~~~~~~~~
191208
You can’t perform that action at this time.
0 commit comments