Skip to content

Commit d7eee52

Browse files
committed
Edit Python propagation doc
1 parent d8c5612 commit d7eee52

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

content/en/docs/languages/python/propagation.md

+28-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,29 @@ Although not limited to tracing, it is what allows traces to build causal
99
information about a system across services that are arbitrarily distributed
1010
across process and network boundaries.
1111

12-
## Manual W3C Trace Context Propagation
12+
OpenTelemetry provides a text-based approach to propagate context to remote
13+
services using the [W3C Trace Context](https://www.w3.org/TR/trace-context/)
14+
HTTP headers.
1315

14-
The following generic example demonstrates how you can propagate trace context
16+
## Automatic context propagation
17+
18+
Auto-instrumentation exists for some popular Python frameworks.
19+
20+
{{% alert title="Note" %}}
21+
22+
Use auto-instrumentation or instrumentation libraries to propagate context.
23+
Although it is possible to propagate context manually, the Python
24+
auto-instrumentation and instrumentation libraries are well-tested and easier
25+
to use.
26+
27+
{{% /alert %}}
28+
29+
## Manual context propagation
30+
31+
The following generic example shows how you can propagate trace context
1532
manually.
1633

17-
First, on the sending service, you'll need to inject the current `context`:
34+
First, on the sending service, inject the current `context`:
1835

1936
```python
2037
from flask import Flask
@@ -49,8 +66,8 @@ if __name__ == '__main__':
4966
app.run(port=5002)
5067
```
5168

52-
On the receiving service, you'll need to extract `context` (for example, from
53-
parsed HTTP headers) and then set them as the current trace context.
69+
On the receiving service, extract `context`, for example, from
70+
parsed HTTP headers, and then set them as the current trace context.
5471

5572
```python
5673
from flask import Flask, request
@@ -91,4 +108,9 @@ if __name__ == '__main__':
91108
```
92109

93110
From there, when you have a deserialized active context, you can create spans
94-
that will be a part of the same trace from the other service.
111+
that are part of the same trace from the other service.
112+
113+
## Next steps
114+
115+
To learn more about propagation, read the
116+
[Propagators API specification](/docs/specs/otel/context/api-propagators/).

0 commit comments

Comments
 (0)