Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that continue_trace does not start transaction #9771

Open
szokeasaurusrex opened this issue Apr 22, 2024 · 0 comments
Open

Clarify that continue_trace does not start transaction #9771

szokeasaurusrex opened this issue Apr 22, 2024 · 0 comments
Labels
Platform: Python Team: Web Backend SDKs team-web-sdk-backend Type: Content Issues about the contents of our docs

Comments

@szokeasaurusrex
Copy link
Member

szokeasaurusrex commented Apr 22, 2024

Core or SDK?

Platform/SDK

Which part? Which one?

Python

Description

The documentation should clarify the fact that while continue_trace creates transactions, it does not start them. For instance, if one has the following code:

with sentry_sdk.continue_trace(sampled=True, ...):
    ...  # do something ...

The generated transaction does not get sent to Sentry (despite the sampled=True) because the transaction was not started with start_transaction.

Suggested Solution

The above sample can be corrected as follows:

transaction = sentry_sdk.continue_trace(sampled=True, ...)
with sentry_sdk.start_transaction(transaction):
    ...  # do something ...

This way, the transaction is continued from the trace, and it gets started properly.


We should include an example like the above somewhere in the docs, and also explain that transactions must always be started with start_transaction. A good place to do this might be here.

Making these changes will help avoid the confusion that led to getsentry/sentry-python#2990 being opened, even though the behavior described in that issue is expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Python Team: Web Backend SDKs team-web-sdk-backend Type: Content Issues about the contents of our docs
Projects
None yet
Development

No branches or pull requests

1 participant