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(core): Introduce seperate client options #4927

Merged
merged 33 commits into from
Apr 19, 2022
Merged

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Apr 12, 2022

This PR works toward differentiating the options that are passed into Sentry.init and the options passed into clients. We want to make this differentiation to minimize internal state in the client, and instead rely on the max number of items being passed in to the client constructor.

We do this by explicitly differentiating between the options that are configured in sdk init (Options) and the options that are passed into the client constructor (ClientOptions).

After this gets merged in, there are a couple next steps here:

  1. Continue work on feat: Switch to new transports #4943, and properly swap to the new transports.
  2. Refactor the exported init functions to reduce bundle
  3. Improve getIntegrationsToSetup so it doesn't rely on the entire options object anymore
  4. Change defaultIntegrations to a simple boolean
  5. Determine if we should introduce a initRaw function

Part 1 of https://getsentry.atlassian.net/browse/WEB-843

@AbhiPrasad AbhiPrasad force-pushed the v7-options-from-client branch 2 times, most recently from 213eb37 to 129b929 Compare April 13, 2022 15:18
@github-actions
Copy link
Contributor

github-actions bot commented Apr 13, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.23 KB (+0.84% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 64.4 KB (-0.22% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.86 KB (+0.46% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 58.05 KB (+0.18% 🔺)
@sentry/browser - Webpack (gzipped + minified) 23.42 KB (+0.9% 🔺)
@sentry/browser - Webpack (minified) 81.29 KB (-1.41% 🔽)
@sentry/react - Webpack (gzipped + minified) 23.46 KB (+0.9% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 48 KB (+0.01% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.08 KB (+0.39% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.45 KB (+0.17% 🔺)

@AbhiPrasad
Copy link
Member Author

We've decided to hold off on this until we finish the transport/client changes!

@AbhiPrasad AbhiPrasad marked this pull request as ready for review April 18, 2022 15:32
@AbhiPrasad AbhiPrasad requested review from a team, lforst and lobsterkatie and removed request for a team April 18, 2022 15:32
stackParser: stackParserFromOptions(options),
integrations: getIntegrationsToSetup(options),
// TODO(v7): get rid of transport being passed down below
transport: options.transport || (supportsFetch() ? FetchTransport : XHRTransport),
Copy link
Member Author

Choose a reason for hiding this comment

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

this is a huge hack, but given we are switching to the new transports, left it as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

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

Great work! Some minor things @Lms24 and I will try to resolve.

packages/core/src/baseclient.ts Show resolved Hide resolved
packages/core/src/integration.ts Show resolved Hide resolved
packages/core/test/mocks/client.ts Outdated Show resolved Hide resolved
packages/core/test/lib/sdk.test.ts Outdated Show resolved Hide resolved
packages/node/test/integrations/linkederrors.test.ts Outdated Show resolved Hide resolved
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

LGTM now. Approving this but since I also worked on it, someone else should probably approve, too.

@AbhiPrasad AbhiPrasad merged commit 6227c7f into 7.x Apr 19, 2022
@AbhiPrasad AbhiPrasad deleted the v7-options-from-client branch April 19, 2022 16:46
onurtemizkan pushed a commit that referenced this pull request Apr 21, 2022
This PR works toward differentiating the options that are passed into `Sentry.init` and the options passed into clients. We want to make this differentiation to minimize internal state in the client, and instead rely on the max number of items being passed in to the client constructor. We do this by explicitly differentiating between the options that are configured in sdk init (`Options`) and the options that are passed into the client constructor (`ClientOptions`).
onurtemizkan pushed a commit that referenced this pull request Apr 21, 2022
This PR works toward differentiating the options that are passed into `Sentry.init` and the options passed into clients. We want to make this differentiation to minimize internal state in the client, and instead rely on the max number of items being passed in to the client constructor. We do this by explicitly differentiating between the options that are configured in sdk init (`Options`) and the options that are passed into the client constructor (`ClientOptions`).
Lms24 pushed a commit that referenced this pull request Apr 26, 2022
This PR works toward differentiating the options that are passed into `Sentry.init` and the options passed into clients. We want to make this differentiation to minimize internal state in the client, and instead rely on the max number of items being passed in to the client constructor. We do this by explicitly differentiating between the options that are configured in sdk init (`Options`) and the options that are passed into the client constructor (`ClientOptions`).
lobsterkatie pushed a commit that referenced this pull request Apr 26, 2022
This PR works toward differentiating the options that are passed into `Sentry.init` and the options passed into clients. We want to make this differentiation to minimize internal state in the client, and instead rely on the max number of items being passed in to the client constructor. We do this by explicitly differentiating between the options that are configured in sdk init (`Options`) and the options that are passed into the client constructor (`ClientOptions`).
lobsterkatie pushed a commit that referenced this pull request Apr 26, 2022
This PR works toward differentiating the options that are passed into `Sentry.init` and the options passed into clients. We want to make this differentiation to minimize internal state in the client, and instead rely on the max number of items being passed in to the client constructor. We do this by explicitly differentiating between the options that are configured in sdk init (`Options`) and the options that are passed into the client constructor (`ClientOptions`).
AbhiPrasad added a commit that referenced this pull request May 30, 2022
This PR works toward differentiating the options that are passed into `Sentry.init` and the options passed into clients. We want to make this differentiation to minimize internal state in the client, and instead rely on the max number of items being passed in to the client constructor. We do this by explicitly differentiating between the options that are configured in sdk init (`Options`) and the options that are passed into the client constructor (`ClientOptions`).
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