Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Mar 11, 2024

This PR moves globalScope and globalMetricsAggregators to the __SENTRY__ global singleton.

This means that if the files that these globals are in get bundled or different versions of @sentry/core are used, we can be sure that they'll still access the same globals.

@timfish timfish marked this pull request as ready for review March 11, 2024 21:06
@timfish timfish requested a review from AbhiPrasad March 11, 2024 23:35
@mydea
Copy link
Member

mydea commented Mar 12, 2024

This is good, I also wanted to do that!
Just one thing, could we also move the defaultCurrentScope & defaultIsolationScope there? I guess the same things apply there.

@timfish
Copy link
Collaborator Author

timfish commented Mar 12, 2024

could we also move the defaultCurrentScope & defaultIsolationScope

Possibly. I was looking through hub.ts and it appears that much of that file will be gone for v8? Will defaultCurrentScope and defaultIsolationScope still be required?

@AbhiPrasad
Copy link
Member

Will defaultCurrentScope and defaultIsolationScope still be required

it will as per getsentry/rfcs#122

@timfish
Copy link
Collaborator Author

timfish commented Mar 12, 2024

Ah, I think it's the default* naming that confused me. These are simply the currentScope and isolationScope?

What happens when Hub is gone, will there need to be a new type to store the scopes that can be saved in the async storage? { current: Scope, isolation: Scope}

Ahhhhh ok, so are defaultCurrentScope and defaultIsolationScope only the current and isolation scopes when no async storage exists? ie. the fallback used in the browser (for now) and also when nothing was found in the async storage?

@mydea
Copy link
Member

mydea commented Mar 12, 2024

Ah, I think it's the default* naming that confused me. These are simply the currentScope and isolationScope?

What happens when Hub is gone, will there need to be a new type to store the scopes that can be saved in the async storage? { current: Scope, isolation: Scope}

Ahhhhh ok, so are defaultCurrentScope and defaultIsolationScope only the current and isolation scopes when no async storage exists? ie. the fallback used in the browser (for now) and also when nothing was found in the async storage?

They are basically the initial current/isolation scope - so if no async context is forked off yet, these will be the ones that are used - exactly! :)

@AbhiPrasad AbhiPrasad merged commit 34d7e41 into develop Mar 12, 2024
@AbhiPrasad AbhiPrasad deleted the timfish/move-globals-to-sentry branch March 12, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants