-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(core): Only generate eventIds in client #6247
Conversation
size-limit report 📦
|
packages/core/src/hub.ts
Outdated
return (this._lastEventId = | ||
this._withClient((client, scope) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Can we make this assignment a little clearer by first assigning this._lastEventId
and then returning it? Or does this syntax save significantly more bundle size? Just asking because it took me a second to realize what's going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I was maybe overzealous with the bundle size saving here, will refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function makeClient() { | ||
return { | ||
getOptions: jest.fn(), | ||
captureEvent: jest.fn(), | ||
captureException: jest.fn(), | ||
captureException: jest.fn().mockReturnValue(MOCK_EVENT_ID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are we using this value? Couldn't find usage in the changed tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MOCK_EVENT_ID
is what hub.lastEventId()
is being set as. It's not being directly asserted on, just used as a return value from captureException
(so we can differentiate between undefined)
packages/hub/test/hub.test.ts
Outdated
|
||
expect(args[2].event_id).toBeTruthy(); | ||
const id = hub.captureMessage('a'); | ||
expect(id).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Probably related to my point above but can we check the id here for a more precise value than it being truthy or is this alright (totally your call, just asking)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All I care about is that this is not undefined, will adjust for that.
|
||
expect(args[1].event_id).toBeTruthy(); | ||
const id = hub.captureEvent(event); | ||
expect(id).toBeTruthy(); | ||
}); | ||
|
||
test('should keep event_id from hint', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ("from hint") still correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup it is
This reverts commit 3fe5f7a.
Fixes #6244
This changes moves all generation of eventId uuids to the client. Since we can't change the signature of
hub.captureException
and similar, we return a event id of zeros,00000000000000000000000000000000
, if the client method returns undefined.This should improve the performance of the SDKs!