Repository navigation
Conversation
A request session is now recorded when the errors of the request have left the event pipeline, not when the response ends. A session that settles during a flush is sent with that flush. The status is still set when an error is captured, so the counts do not change. This prepares the fix for #25605, which decides the status in the event pipeline. Refs #25605
size-limit report 📦Compared: f04e713 (PR test merge using base PR #27138 at f8f90a3) Against: 89bc3c1 (base PR #27138) · base run #68760 ✅ Baseline matches: this diff contains only this PR's changes.
|
Optional E2E testsSome optional checks were not successful. They do not block the merge. 1 not successful, 64 successful. See the run.
Successful checks
|
|
@sentry-junior review |
| client.captureException(new Error('foo')); | ||
| endErroredRequestSession(); | ||
|
|
||
| const flushed = client.flush(); |
There was a problem hiding this comment.
[m] packages/core/test/lib/server-runtime-client.test.ts:209: Both new tests pass without the change
The new path in startRequestSession isn't proven by a test. That path waits on pendingErrors, then sends at once if a flush ran in the meantime. captureException still sets the status synchronously. So on the base, the session goes into the aggregate at endErroredRequestSession() and the flush hook sends it, which gives the same sendSession calls in both tests. I reverted the four src files to the base (f8f90a3), and both tests in request sessions still pass.
This assertion checks that nothing is sent while beforeSend is still pending. With it, the first test fails on the base and passes on this head:
| const flushed = client.flush(); | |
| const flushed = client.flush(); | |
| expect(sendSessionSpy).not.toHaveBeenCalled(); |
The second test (aggregates a session that settles after the request ended when no flush runs) has the same gap.
What
A request session is now recorded when the errors of the request have left the event pipeline, not when the response ends. A session that settles during a
flush()is sent with that flush.The counts do not change. The status is still set when an error is captured.
Part 2 of 3 for #25605. Stacked on #27138. #26819 is stacked on this PR.
Why
#26819 decides the session status in the event pipeline, after
beforeSend. With an async event processor or an asyncbeforeSend, that result can come after the response ended, so the session must wait for it.This PR adds only the wait, so that the flush handling can be reviewed without the counting rules.
Refs #25605