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

feat: Always assemble Envelopes #9101

Merged
merged 11 commits into from Sep 27, 2023
Merged

feat: Always assemble Envelopes #9101

merged 11 commits into from Sep 27, 2023

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Sep 25, 2023

This PR changes a few things:

Note: Integrations aren't initialized by default so the overhead added with this change, eventho we assemble Envelopes now, should be minimal/non-existent if someone disabled the SDK.

This is to enable Spotlight to work:
https://github.com/getsentry/spotlight/pull/3/files#diff-0b5adbfe7b36e4ae2f479291e20152e33e940f7f265162d77f40f6bdb5da7405R75

@HazAT HazAT changed the title fix conflight feat: Always assemble Envelopes Sep 25, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 25, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 75.55 KB (-0.05% 🔽)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.44 KB (-0.08% 🔽)
@sentry/browser - Webpack (gzipped) 22.04 KB (-0.12% 🔽)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 70.26 KB (-0.03% 🔽)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.55 KB (-0.09% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped) 20.63 KB (-0.1% 🔽)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 222.11 KB (-0.05% 🔽)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 86.47 KB (-0.12% 🔽)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 61.32 KB (-0.17% 🔽)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.4 KB (-0.09% 🔽)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 75.57 KB (-0.05% 🔽)
@sentry/react - Webpack (gzipped) 22.07 KB (-0.11% 🔽)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 93.43 KB (-0.07% 🔽)
@sentry/nextjs Client - Webpack (gzipped) 50.98 KB (-0.12% 🔽)

@HazAT HazAT marked this pull request as ready for review September 26, 2023 10:43
@@ -297,8 +292,8 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
/**
* Sets up the integrations
*/
public setupIntegrations(): void {
if (this._isEnabled() && !this._integrationsInitialized) {
public setupIntegrations(forceInitialize?: boolean): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Maybe it would be nicer to split this into to methods, than to have this argument:

public setupIntegrations(): void {
  if (this._isEnabled() && !this._integrationsInitialized) {
    this.initializeIntegrations(); // <-- naming TBD??
  }
}

public initializeIntegrations(): void {
  this._integrations = setupIntegrations(this, this._options.integrations);
  this._integrationsInitialized = true;
}

I guess the idea is that e.g. spotlight would initialize sentry integrations even if not enabled? So that could then just call client.initializeIntegration()?

Copy link
Member Author

@HazAT HazAT Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep see https://github.com/getsentry/spotlight/pull/3/files#diff-0b5adbfe7b36e4ae2f479291e20152e33e940f7f265162d77f40f6bdb5da7405R78

will change it, like your proposal
actually, this might be worth doing when we rethink how integrations work
the problem is, I still want to make sure that calling this more than once doesn't setup integrations more than once

with this change, it's not guaranteed that an integration will only be called once

@HazAT HazAT enabled auto-merge (squash) September 27, 2023 12:30
@HazAT HazAT merged commit d4f67a2 into develop Sep 27, 2023
82 checks passed
@HazAT HazAT deleted the feat/spotlight branch September 27, 2023 13:33
c298lee pushed a commit that referenced this pull request Sep 27, 2023
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.

None yet

3 participants