Skip to content

Commit

Permalink
ref(python): Clarify that continue_trace does not start a transaction (
Browse files Browse the repository at this point in the history
  • Loading branch information
sentrivana authored Sep 11, 2024
1 parent 2d71c0c commit 014af4f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ from my_project import get_incoming_headers_as_dict

headers = get_incoming_headers_as_dict()

sentry_sdk.continue_trace(headers)
transaction = sentry_sdk.continue_trace(headers)
with sentry_sdk.start_transaction(transaction):
...
```

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.

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.

`continue_trace()` returns a transaction, but does not start it. To start the transaction, use `start_transaction()`.


## 2. Inject Tracing Information to Outgoing Requests

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.
Expand Down

0 comments on commit 014af4f

Please sign in to comment.