Skip to content

Commit 014af4f

Browse files
authored
ref(python): Clarify that continue_trace does not start a transaction (#11315)
1 parent 2d71c0c commit 014af4f

File tree

1 file changed

+6
-1
lines changed
  • platform-includes/distributed-tracing/custom-instrumentation

1 file changed

+6
-1
lines changed

platform-includes/distributed-tracing/custom-instrumentation/python.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ from my_project import get_incoming_headers_as_dict
1818

1919
headers = get_incoming_headers_as_dict()
2020

21-
sentry_sdk.continue_trace(headers)
21+
transaction = sentry_sdk.continue_trace(headers)
22+
with sentry_sdk.start_transaction(transaction):
23+
...
2224
```
2325

2426
In this example, `get_incoming_headers_as_dict()` returns a dictionary that contains tracing information from HTTP headers, environment variables, or any other mechanism your project uses to communicate with the outside world.
2527

2628
Sentry's `continue_trace()` function will extract the given headers, try to find the `sentry-trace` and `baggage` headers, and store them in memory for later use.
2729

30+
`continue_trace()` returns a transaction, but does not start it. To start the transaction, use `start_transaction()`.
31+
32+
2833
## 2. Inject Tracing Information to Outgoing Requests
2934

3035
For distributed tracing to work, the two headers `sentry-trace` and `baggage`, must be added to outgoing requests. If you pregenerate HTML on the server-side, you might want to take a look at [Inject Tracing Information into Rendered HTML](#inject-tracing-information-into-rendered-html), which describes how to pass on tracing information through HTML meta tags.

0 commit comments

Comments
 (0)