@sentry/replay 7.70.0 → 7.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +48 -40
- package/cjs/index.js.map +1 -1
- package/esm/index.js +48 -40
- package/esm/index.js.map +1 -1
- package/package.json +5 -5
- package/types/coreHandlers/handleGlobalEvent.d.ts.map +1 -1
- package/types/util/addGlobalListeners.d.ts.map +1 -1
package/esm/index.js
CHANGED
|
@@ -4998,53 +4998,56 @@ function handleGlobalEventListener(
|
|
|
4998
4998
|
) {
|
|
4999
4999
|
const afterSendHandler = includeAfterSendEventHandling ? handleAfterSendEvent(replay) : undefined;
|
|
5000
5000
|
|
|
5001
|
-
return (
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5001
|
+
return Object.assign(
|
|
5002
|
+
(event, hint) => {
|
|
5003
|
+
// Do nothing if replay has been disabled
|
|
5004
|
+
if (!replay.isEnabled()) {
|
|
5005
|
+
return event;
|
|
5006
|
+
}
|
|
5006
5007
|
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5008
|
+
if (isReplayEvent(event)) {
|
|
5009
|
+
// Replays have separate set of breadcrumbs, do not include breadcrumbs
|
|
5010
|
+
// from core SDK
|
|
5011
|
+
delete event.breadcrumbs;
|
|
5012
|
+
return event;
|
|
5013
|
+
}
|
|
5013
5014
|
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5015
|
+
// We only want to handle errors & transactions, nothing else
|
|
5016
|
+
if (!isErrorEvent(event) && !isTransactionEvent(event)) {
|
|
5017
|
+
return event;
|
|
5018
|
+
}
|
|
5018
5019
|
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5020
|
+
// Unless `captureExceptions` is enabled, we want to ignore errors coming from rrweb
|
|
5021
|
+
// As there can be a bunch of stuff going wrong in internals there, that we don't want to bubble up to users
|
|
5022
|
+
if (isRrwebError(event, hint) && !replay.getOptions()._experiments.captureExceptions) {
|
|
5023
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('[Replay] Ignoring error from rrweb internals', event);
|
|
5024
|
+
return null;
|
|
5025
|
+
}
|
|
5025
5026
|
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5027
|
+
// When in buffer mode, we decide to sample here.
|
|
5028
|
+
// Later, in `handleAfterSendEvent`, if the replayId is set, we know that we sampled
|
|
5029
|
+
// And convert the buffer session to a full session
|
|
5030
|
+
const isErrorEventSampled = shouldSampleForBufferEvent(replay, event);
|
|
5030
5031
|
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5032
|
+
// Tag errors if it has been sampled in buffer mode, or if it is session mode
|
|
5033
|
+
// Only tag transactions if in session mode
|
|
5034
|
+
const shouldTagReplayId = isErrorEventSampled || replay.recordingMode === 'session';
|
|
5034
5035
|
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5036
|
+
if (shouldTagReplayId) {
|
|
5037
|
+
event.tags = { ...event.tags, replayId: replay.getSessionId() };
|
|
5038
|
+
}
|
|
5038
5039
|
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5040
|
+
// In cases where a custom client is used that does not support the new hooks (yet),
|
|
5041
|
+
// we manually call this hook method here
|
|
5042
|
+
if (afterSendHandler) {
|
|
5043
|
+
// Pretend the error had a 200 response so we always capture it
|
|
5044
|
+
afterSendHandler(event, { statusCode: 200 });
|
|
5045
|
+
}
|
|
5045
5046
|
|
|
5046
|
-
|
|
5047
|
-
|
|
5047
|
+
return event;
|
|
5048
|
+
},
|
|
5049
|
+
{ id: 'Replay' },
|
|
5050
|
+
);
|
|
5048
5051
|
}
|
|
5049
5052
|
|
|
5050
5053
|
/**
|
|
@@ -6420,7 +6423,12 @@ function addGlobalListeners(replay) {
|
|
|
6420
6423
|
|
|
6421
6424
|
// Tag all (non replay) events that get sent to Sentry with the current
|
|
6422
6425
|
// replay ID so that we can reference them later in the UI
|
|
6423
|
-
|
|
6426
|
+
const eventProcessor = handleGlobalEventListener(replay, !hasHooks(client));
|
|
6427
|
+
if (client && client.addEventProcessor) {
|
|
6428
|
+
client.addEventProcessor(eventProcessor);
|
|
6429
|
+
} else {
|
|
6430
|
+
addGlobalEventProcessor(eventProcessor);
|
|
6431
|
+
}
|
|
6424
6432
|
|
|
6425
6433
|
// If a custom client has no hooks yet, we continue to use the "old" implementation
|
|
6426
6434
|
if (hasHooks(client)) {
|