-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
dotnet: clarify global mode transaction state #12919
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
Conversation
|
@mattico is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
|
@jamescrosswell do you have any thought on this? |
|
Taking another crack at it: When Global Mode is **enabled**, a single scope stack is shared by the whole application. This is the recommended mode for UI applications.
When Global Mode is **disabled**, the scope data is tied to the currently executing context. This is the recommended mode for server applications.
Since version 5.0.0 the scope's `Transaction` is always tied to the currently executing context, regardless of the Global Mode configuration.
<Alert level="info">
What does it mean for data to be "tied to the currently executing context?" In general, each async `Task`, `Thread`, or web request
has its own ExecutionContext. Data which is written to this context is visible to child tasks or threads, but not to parent tasks
or threads.
For more information see [the .NET ExecutionContext documentation](https://learn.microsoft.com/en-us/dotnet/api/system.threading.executioncontext).
</Alert> |
jamescrosswell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @mattico! Much appreciated ❤️
I've suggested one small tweak to the wording on the last paragraph but otherwise all good!
Co-authored-by: James Crosswell <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
|
Thanks a lot! And thanks for your (collective) patience! |
DESCRIBE YOUR PR
Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.
Following getsentry/sentry-dotnet#3596, the scope Transaction is always stored in an AsyncLocal, regardless of the GlobalMode configuration. Updating the docs to state this will help others avoid needing to read the SDK source in order to figure out why their transactions become unset on the scope during task switches.
I'm not completely sure about the wording. The nice thing about ExecutionContext and the GlobalMode defaults is that in the vast majority of cases they work intuitively, and ExecutionContext is an implementation detail that users can ignore. But in those special cases I think it's helpful to explain what's actually happening to help the user understand it.
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
LEGAL BOILERPLATE
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
EXTRA RESOURCES