Repository navigation
Conversation
|
bugbot run |
size-limit report 📦Compared: c2007eb (PR test merge using develop at e1026aa) Against: e1026aa (develop) · base run #63365 ✅ Baseline matches: this diff contains only this PR's changes.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e4c2c57. Configure here.
|
|
||
| if (flushNow) { | ||
| flushPendingClientAggregates(); | ||
| } |
There was a problem hiding this comment.
Flush-now skips existing aggregates
Medium Severity
When a request session settles after client.flush(), flushNow only sends if this call created the aggregate. Another request that records during that wait can already have opened a bucket, so this session is added and not sent. The in-flight flush then drains the transport without it, and a shutdown flush can drop the session.
Reviewed by Cursor Bugbot for commit e4c2c57. Configure here.
There was a problem hiding this comment.
I think one way we could solve this is by adding something like an afterFlushProcessing client hook that the client emits in its flush method after determining clientFinished. This should allow us to get rid of the flushNow flag that only worked locally for this request
Optional E2E testsSome optional checks were not successful. They do not block the merge. 1 not successful, 64 successful. See the run.
Successful checks
|
Lms24
left a comment
There was a problem hiding this comment.
Thanks for fixing this, I admittedly forgot about the server side part when we made the change in browser.
Took me a bit to understand the pendingRequests logic but I think it's fine and shouldn't hurt us or leak memory (that is assuming the isolationScope cleans up at which point the references to the pending errors should be gc'd).
I think we still should address the bugbot comment but otherwise, looks great!
The scenario sets `sessionFlushingDelayMS` on `httpIntegration`, which has no effect with `@sentry/bun`, so the session aggregate arrives after the test timeout.
…n-filtered-errors
A session that settled while `client.flush()` waited for event processing was only sent when it opened a new aggregate. If another request opened an aggregate during that wait, the session joined it and that flush did not send it. Add an `afterFlushProcessing` client hook, which `flush()` emits after event processing and before the transport flush. Request session aggregates now also send on this hook.
…n-filtered-errors
|
A short update on this PR as I did not merge it yet. The other PR (#25751) working on sampled-out errors was not yet merged and I wanted to get this in as well. And the changes in this PR here (25632) do not fix the problem. The ProblemA request session records an error whether one server request had an error (for the "crash-free" rate). The server SDK marks the request session as errored at the point the error is captured (no filter ran at this point). So errors dropped in The spechttps://develop.sentry.dev/sdk/telemetry/sessions/#session-update-filtering This should be the order: event processors (incl.
Why the current state of this PR does not workThis PR moves the session update after DedupeDedupe drops an error if it is equal to the previous error. It stores one previous error for the whole client, and all requests share it.
SamplingAs (per spec) sampled-out errors must still update the session. So a sampled-out error that can update/change a session runs through the full pipeline, only to update the session. Develop already does this for the scope session. This PR also does it for request sessions, and on a server almost every error can change its request session. But this has two problems:
What this PR will doSo we still need to make sure we keep sampled-out errors in mind for the crash-free rate, but we cannot go through the whole pipeline as this would lead to an overflow. So we make two buffers:
The cost: Spec Update?Open question: the Client spec says event processor drops MUST NOT update the session. We count Dedupe drops anyway, because Dedupe drops to save quota, not because the developer chose to ignore the error. We should probably mention this explicitly in the spec. Flow before/after
|


Errors that
ignoreErrors,beforeSendor an event processor drops no longer mark the request session as errored or crashed. Errors thatsampleRatedrops still count. This is the same rule that already applies to client sessions since #22671.Before,
ServerRuntimeClientset the request session status incaptureException/captureEvent, before the event pipeline ran. Now the status is set at the same point in the pipeline as the client session update.Event processing can finish after the response ends (e.g. async ContextLines reads). Because of this, the request session now waits for its pending error events before it is recorded. If
client.flush()runs during that wait, the session is sent immediately. This is necessary because the flush sends the aggregate before it waits for event processing.Reference PR: #25751
Fixes #25605