Skip to content

Conversation

@mattico
Copy link
Contributor

@mattico mattico commented Mar 4, 2025

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.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

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

@vercel
Copy link

vercel bot commented Mar 4, 2025

@mattico is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@coolguyzone coolguyzone requested a review from bitsandfoxes March 5, 2025 22:35
@bitsandfoxes
Copy link
Contributor

@jamescrosswell do you have any thought on this?

@mattico
Copy link
Contributor Author

mattico commented Mar 27, 2025

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>

Copy link
Collaborator

@jamescrosswell jamescrosswell left a 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!

@vercel
Copy link

vercel bot commented Apr 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2025 7:56am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2025 7:56am
develop-docs ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2025 7:56am

@bitsandfoxes
Copy link
Contributor

Thanks a lot! And thanks for your (collective) patience!

@bitsandfoxes bitsandfoxes merged commit 2ecbffb into getsentry:master Apr 4, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants