Skip to content

Commit 24ecd3a

Browse files
authored
feat(replay): Record outcome when event buffer size exceeded (#17946)
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 f94b203 commit 24ecd3a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.size-limit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ module.exports = [
7575
path: 'packages/browser/build/npm/esm/index.js',
7676
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'replayCanvasIntegration'),
7777
gzip: true,
78-
limit: '84 KB',
78+
limit: '85 KB',
7979
},
8080
{
8181
name: '@sentry/browser (incl. Tracing, Replay, Feedback)',

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)