Conversation
Contributor
size-limit report 📦
|
mydea
reviewed
Sep 26, 2023
| */ | ||
| public setupIntegrations(): void { | ||
| if (this._isEnabled() && !this._integrationsInitialized) { | ||
| public setupIntegrations(forceInitialize?: boolean): void { |
Member
There was a problem hiding this comment.
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()?
Member
Author
There was a problem hiding this comment.
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
lforst
approved these changes
Sep 27, 2023
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes a few things:
if no transport is defined, the client does nothing. The default behavior is no DSN = no transport, but if someone manually adds a transport that could do anything with the events, we shouldn't fully disable the SDK.
see https://github.com/getsentry/sentry-javascript/pull/9101/files#diff-9b99586572e171cbe9f43e400ce8c631dfc032990c52e95632fc488dde6b1cf4L536
forceInitializeoptional boolean tosetupIntegrationsto be able to initialize global integrations externally.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