diff --git a/.size-limit.js b/.size-limit.js index 17e33dd7ff21..5de4268a53d6 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -75,7 +75,7 @@ module.exports = [ path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'replayCanvasIntegration'), gzip: true, - limit: '84 KB', + limit: '85 KB', }, { name: '@sentry/browser (incl. Tracing, Replay, Feedback)', diff --git a/packages/replay-internal/src/util/addEvent.ts b/packages/replay-internal/src/util/addEvent.ts index a133d9de6303..0cd76227379c 100644 --- a/packages/replay-internal/src/util/addEvent.ts +++ b/packages/replay-internal/src/util/addEvent.ts @@ -83,6 +83,14 @@ async function _addEvent( } catch (error) { const isExceeded = error && error instanceof EventBufferSizeExceededError; const reason = isExceeded ? 'addEventSizeExceeded' : 'addEvent'; + const client = getClient(); + + if (client) { + // We are limited in the drop reasons: + // https://github.com/getsentry/snuba/blob/6c73be60716c2fb1c30ca627883207887c733cbd/rust_snuba/src/processors/outcomes.rs#L39 + const dropReason = isExceeded ? 'buffer_overflow' : 'internal_sdk_error'; + client.recordDroppedEvent(dropReason, 'replay'); + } if (isExceeded && isBufferMode) { // Clear buffer and wait for next checkout @@ -95,12 +103,6 @@ async function _addEvent( replay.handleException(error); await replay.stop({ reason }); - - const client = getClient(); - - if (client) { - client.recordDroppedEvent('internal_sdk_error', 'replay'); - } } }