Skip to content

Commit fda055d

Browse files
committed
feat(replay): Record outcome when event buffer size exceeded
Change to record an outcome when failed to add to replay event buffer due to size limitations. This also moves up the `internal_sdk_error` outcome to be recorded before we stop the replay. Note we use the `buffer_overflow` outcome as it is the closest in meaning (source https://github.com/getsentry/snuba/blob/6c73be60716c2fb1c30ca627883207887c733cbd/rust_snuba/src/processors/outcomes.rs#L39)
1 parent 480217f commit fda055d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/replay-internal/src/util/addEvent.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ async function _addEvent(
8383
} catch (error) {
8484
const isExceeded = error && error instanceof EventBufferSizeExceededError;
8585
const reason = isExceeded ? 'addEventSizeExceeded' : 'addEvent';
86+
const client = getClient();
87+
88+
if (client) {
89+
// We are limited in the drop reasons:
90+
// https://github.com/getsentry/snuba/blob/6c73be60716c2fb1c30ca627883207887c733cbd/rust_snuba/src/processors/outcomes.rs#L39
91+
const dropReason = isExceeded ? 'buffer_overflow' : 'internal_sdk_error';
92+
client.recordDroppedEvent(dropReason, 'replay');
93+
}
8694

8795
if (isExceeded && isBufferMode) {
8896
// Clear buffer and wait for next checkout
@@ -95,12 +103,6 @@ async function _addEvent(
95103
replay.handleException(error);
96104

97105
await replay.stop({ reason });
98-
99-
const client = getClient();
100-
101-
if (client) {
102-
client.recordDroppedEvent('internal_sdk_error', 'replay');
103-
}
104106
}
105107
}
106108

0 commit comments

Comments
 (0)