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

Use SyncPromise internally & Remove deprecated API & Trim Public API #1858

Merged
merged 17 commits into from
Feb 8, 2019

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Jan 28, 2019

This PR changes the internals of all the SDKs to be less async.
This means that instead of internally using async/await / Promise mostly everywhere, we now use our own implementation SyncPromise.

SyncPromise is as the name says sync if everything is called directly.
This has a lot of advantages when it comes to very high volume calls to our SDKs.

Right now this is marked as a major bump because of the huge internal changes.
The public facing API shouldn't change, only the API for Client changes.
Also, we are hiding the Backend from the package, to not expose SyncPromise.

If you were using the minimal package or the SDK as we advertised it in the official docs, you shouldn't notice anything.

@HazAT HazAT self-assigned this Jan 28, 2019
@HazAT HazAT requested a review from kamilogorek as a code owner January 28, 2019 21:29
@HazAT HazAT added this to the 5.0.0 milestone Jan 28, 2019
@getsentry-bot
Copy link
Contributor

getsentry-bot commented Jan 28, 2019

Warnings
⚠️ Please add a changelog entry for your changes.
Messages
📖 ✅ TSLint passed
📖 @sentry/browser gzip'ed minified size: 21.6426 kB

Generated by 🚫 dangerJS

@HazAT HazAT changed the title [WIP] 5.0.0 [WIP] Use SyncPromise internally Jan 31, 2019
@HazAT HazAT changed the base branch from master to major/5 January 31, 2019 11:09
@HazAT HazAT changed the title [WIP] Use SyncPromise internally [WIP] Use SyncPromise internally & Remove deprecated API & Trim Public API Feb 4, 2019
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
packages/browser/test/backend.test.ts Outdated Show resolved Hide resolved
event = await this.eventFromMessage(ex, undefined, hint);
addExceptionTypeValue(event, `${ex}`);
}
public eventFromException(exception: any, hint?: SentryEventHint): SyncPromise<SentryEvent> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not fully convinced about this SyncPromise stuff tbh. It adds a level of indirection when in reality we could just use the fully procedural code here as well.

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 correct, problem is that in node this needs to be "async" meaning that we can do file io in node. The function is defined in the interface of Backend, so even though this fully sync in browser, it isn't in node.

packages/core/src/baseclient.ts Show resolved Hide resolved
packages/utils/src/syncpromise.ts Outdated Show resolved Hide resolved
packages/utils/src/syncpromise.ts Outdated Show resolved Hide resolved

/** JSDoc */
private readonly attachHandler = (handler: Handler<T, any>) => {
this.handlers = this.handlers.concat(handler);
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is odd, as attaching handler always executes it anyway. What's the point of keeping track of them then?

packages/utils/src/syncpromise.ts Outdated Show resolved Hide resolved
describe('isThenable()', () => {
test('should work as advertised', () => {
expect(isThenable(Promise.resolve(true))).toEqual(true);
// expect(isThenable(async () => false)).toEqual(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to add SyncPromise here as well.

@HazAT HazAT changed the title [WIP] Use SyncPromise internally & Remove deprecated API & Trim Public API Use SyncPromise internally & Remove deprecated API & Trim Public API Feb 6, 2019
@HazAT HazAT merged commit 459fdd8 into major/5 Feb 8, 2019
@HazAT
Copy link
Member Author

HazAT commented Feb 8, 2019

Please do not delete the branch yet, we delete it when we merge 5.0.

do not delete the branch yet

@HazAT HazAT mentioned this pull request Feb 8, 2019
8 tasks
HazAT added a commit that referenced this pull request Feb 13, 2019
…1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871
HazAT added a commit that referenced this pull request Feb 15, 2019
…1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871
HazAT added a commit that referenced this pull request Feb 15, 2019
…1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871
HazAT added a commit that referenced this pull request Feb 18, 2019
* fix: Events created from exception shouldnt have top-level message attribute (#1831)

* Use SyncPromise internally & Remove deprecated API & Trim Public API (#1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871

* ref: Move public interfaces to types package

Move addBreadcrumb from the client to the hub

* fix: Tests

* fix: Small type issues

* ref: Remove scope listeners

* fix: Add flush to interface

* ref: Remove interfaces from core
kamilogorek pushed a commit that referenced this pull request Feb 19, 2019
…1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871
kamilogorek pushed a commit that referenced this pull request Feb 19, 2019
* fix: Events created from exception shouldnt have top-level message attribute (#1831)

* Use SyncPromise internally & Remove deprecated API & Trim Public API (#1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871

* ref: Move public interfaces to types package

Move addBreadcrumb from the client to the hub

* fix: Tests

* fix: Small type issues

* ref: Remove scope listeners

* fix: Add flush to interface

* ref: Remove interfaces from core
HazAT added a commit that referenced this pull request Feb 21, 2019
…1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871
HazAT added a commit that referenced this pull request Feb 21, 2019
* fix: Events created from exception shouldnt have top-level message attribute (#1831)

* Use SyncPromise internally & Remove deprecated API & Trim Public API (#1858)

* ref: Move PromiseBuffer and Error to utils package

* ref: Remove all async api

* ref: Remove invokeClientAsync function

* feat: Finish Node SDK

* feat: SyncPromise implementation

* fix: Browser SDK

* fix: beforeSend callback

* fix: Core tests

* fix: linting and tests

* fix: browser npm package + add error for manual tests

* meta: Remove deprecations

* fix: Typedocs and public exposed functions

* meta: Changelog

* Apply suggestions from code review

Co-Authored-By: HazAT <[email protected]>

* fix: CodeReview

* feat: #1871

* ref: Move public interfaces to types package

Move addBreadcrumb from the client to the hub

* fix: Tests

* fix: Small type issues

* ref: Remove scope listeners

* fix: Add flush to interface

* ref: Remove interfaces from core
@HazAT HazAT mentioned this pull request Feb 21, 2019
14 tasks
kamilogorek pushed a commit that referenced this pull request Feb 26, 2019
…PIs (#1858)

* ref: Move PromiseBuffer and Error to utils package
* ref: Remove all async api
* ref: Remove invokeClientAsync function
* feat: Finish Node SDK
* feat: SyncPromise implementation
* fix: Browser SDK
* fix: beforeSend callback
* fix: Core tests
* fix: linting and tests
* fix: browser npm package + add error for manual tests
* meta: Remove deprecations
* fix: Typedocs and public exposed functions
* meta: Changelog
* Apply suggestions from code review
kamilogorek pushed a commit that referenced this pull request Feb 26, 2019
* fix: Events created from exception shouldnt have top-level message attribute (#1831)
* Use SyncPromise internally & Remove deprecated API & Trim Public API (#1858)
* ref: Move PromiseBuffer and Error to utils package
* ref: Remove all async api
* ref: Remove invokeClientAsync function
* feat: Finish Node SDK
* feat: SyncPromise implementation
* fix: Browser SDK
* fix: beforeSend callback
* fix: Core tests
* fix: linting and tests
* fix: browser npm package + add error for manual tests
* meta: Remove deprecations
* fix: Typedocs and public exposed functions
* meta: Changelog
* Apply suggestions from code review
* ref: Move public interfaces to types package
* fix: Tests
* fix: Small type issues
* ref: Remove scope listeners
* fix: Add flush to interface
* ref: Remove interfaces from core
@HazAT HazAT deleted the ref/make-sync branch March 19, 2019 12:12
HazAT added a commit that referenced this pull request Mar 19, 2019
…PIs (#1858)

* ref: Move PromiseBuffer and Error to utils package
* ref: Remove all async api
* ref: Remove invokeClientAsync function
* feat: Finish Node SDK
* feat: SyncPromise implementation
* fix: Browser SDK
* fix: beforeSend callback
* fix: Core tests
* fix: linting and tests
* fix: browser npm package + add error for manual tests
* meta: Remove deprecations
* fix: Typedocs and public exposed functions
* meta: Changelog
* Apply suggestions from code review
HazAT added a commit that referenced this pull request Mar 19, 2019
* fix: Events created from exception shouldnt have top-level message attribute (#1831)
* Use SyncPromise internally & Remove deprecated API & Trim Public API (#1858)
* ref: Move PromiseBuffer and Error to utils package
* ref: Remove all async api
* ref: Remove invokeClientAsync function
* feat: Finish Node SDK
* feat: SyncPromise implementation
* fix: Browser SDK
* fix: beforeSend callback
* fix: Core tests
* fix: linting and tests
* fix: browser npm package + add error for manual tests
* meta: Remove deprecations
* fix: Typedocs and public exposed functions
* meta: Changelog
* Apply suggestions from code review
* ref: Move public interfaces to types package
* fix: Tests
* fix: Small type issues
* ref: Remove scope listeners
* fix: Add flush to interface
* ref: Remove interfaces from core
HazAT added a commit that referenced this pull request Mar 20, 2019
…PIs (#1858)

* ref: Move PromiseBuffer and Error to utils package
* ref: Remove all async api
* ref: Remove invokeClientAsync function
* feat: Finish Node SDK
* feat: SyncPromise implementation
* fix: Browser SDK
* fix: beforeSend callback
* fix: Core tests
* fix: linting and tests
* fix: browser npm package + add error for manual tests
* meta: Remove deprecations
* fix: Typedocs and public exposed functions
* meta: Changelog
* Apply suggestions from code review
HazAT added a commit that referenced this pull request Mar 20, 2019
* fix: Events created from exception shouldnt have top-level message attribute (#1831)
* Use SyncPromise internally & Remove deprecated API & Trim Public API (#1858)
* ref: Move PromiseBuffer and Error to utils package
* ref: Remove all async api
* ref: Remove invokeClientAsync function
* feat: Finish Node SDK
* feat: SyncPromise implementation
* fix: Browser SDK
* fix: beforeSend callback
* fix: Core tests
* fix: linting and tests
* fix: browser npm package + add error for manual tests
* meta: Remove deprecations
* fix: Typedocs and public exposed functions
* meta: Changelog
* Apply suggestions from code review
* ref: Move public interfaces to types package
* fix: Tests
* fix: Small type issues
* ref: Remove scope listeners
* fix: Add flush to interface
* ref: Remove interfaces from core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants