-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(replay): Extract sendReplay
functionality into functions
#6751
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
Conversation
@@ -414,14 +411,12 @@ describe('Integration | sendReplayEvent', () => { | |||
|
|||
await advanceTimers(30000); | |||
expect(mockSendReplayRequest).toHaveBeenCalledTimes(4); | |||
expect(spySendReplay).toHaveBeenCalledTimes(4); |
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.
Note: We cannot spy on recursive calls of modules, it seems, so this is never incremented. IMHO this is well enough tested by ensure that sendReplayRequest
is called X times, we don't really care that much about sendReplay
does.
size-limit report 📦
|
bee9cf7
to
f84854d
Compare
f84854d
to
caec2f7
Compare
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.
Nice, looks like a great change to me.
@@ -34,7 +34,7 @@ type SentReplayExpected = { | |||
replayEventPayload?: ReplayEventPayload; | |||
recordingHeader?: RecordingHeader; | |||
recordingPayloadHeader?: RecordingPayloadHeader; | |||
events?: ReplayRecordingData; | |||
recordingData?: ReplayRecordingData; |
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.
great change, "event" is overloaded enough already 😅
@@ -110,7 +110,7 @@ describe('Integration | stop', () => { | |||
jest.runAllTimers(); | |||
await new Promise(process.nextTick); | |||
expect(replay).toHaveLastSentReplay({ | |||
events: JSON.stringify([ | |||
recordingData: JSON.stringify([ |
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.
Just to double check: This renaming doesn't change anything for the actual envelope content that is sent to Sentry, right? Just don't wanna risk some problem with Relay not finding the field it expects in the envelope
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.
no, this basically reads the SendReplayData
passed around!
This extracts this out into a more functional style.
In addition, it also changes the
timestamp
we put on the replay to always reflect the time we've added it, no matter if it was retried.This also renames a few things for clarity (e.g.
events
that was often passed around is actuallyrecordingData
, so we may as well reflect that in order to be clear about recordingData vs. events).Note: This depends on #6733, where I'll need to merge the changes once that is merged.