-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn repeated thread locality content into an include (#11554)
* Turn repeated thread locality content into an include * Update includes/platforms/configuration/options/thread-locality.mdx Co-authored-by: Liza Mock <[email protected]> --------- Co-authored-by: Alex Krawiec <[email protected]> Co-authored-by: James Crosswell <[email protected]> Co-authored-by: Liza Mock <[email protected]>
- Loading branch information
1 parent
ead1a4f
commit 1377e84
Showing
4 changed files
with
19 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
includes/platforms/configuration/options/thread-locality.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Alert> | ||
|
||
Read on if you're curious to know how thread locality works for scope data. In .NET, there | ||
are two modes for managing ambient data (which is data that's available in different parts of an application and doesn't need to be passed explicitly through method arguments): a disabled global mode and an enabled global mode. Usually, Sentry will automatically choose the most appropriate mode for your application type. However, this can be overridden by setting [`SentryOptions.IsGlobalModeEnabled`](../../configuration/options/#is-global-mode-enabled) manually. | ||
|
||
If global mode is disabled (appropriate for most server-based applications), the | ||
ambient scope data will be stored as an `AsyncLocal` and will flow with the execution | ||
context. Stephen Toub's blog post on [ExecutionContext vs SynchronizationContext](https://devblogs.microsoft.com/pfxteam/executioncontext-vs-synchronizationcontext/) | ||
explains that concept in more detail. | ||
|
||
If global mode is enabled (appropriate for desktop applications), ambient scope data will be | ||
stored as a Singleton and available globally. This means you can set context (such as | ||
the user logged into the application) once and it will be sent with all events, regardless | ||
of whether the event was captured on the UI thread or a background thread. | ||
|
||
</Alert> |