@sentry/replay 7.70.0 → 7.72.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 +54 -40
- package/cjs/index.js.map +1 -1
- package/esm/index.js +54 -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/cjs/index.js
CHANGED
|
@@ -5000,53 +5000,62 @@ function handleGlobalEventListener(
|
|
|
5000
5000
|
) {
|
|
5001
5001
|
const afterSendHandler = includeAfterSendEventHandling ? handleAfterSendEvent(replay) : undefined;
|
|
5002
5002
|
|
|
5003
|
-
return (
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5003
|
+
return Object.assign(
|
|
5004
|
+
(event, hint) => {
|
|
5005
|
+
// Do nothing if replay has been disabled
|
|
5006
|
+
if (!replay.isEnabled()) {
|
|
5007
|
+
return event;
|
|
5008
|
+
}
|
|
5008
5009
|
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5010
|
+
if (isReplayEvent(event)) {
|
|
5011
|
+
// Replays have separate set of breadcrumbs, do not include breadcrumbs
|
|
5012
|
+
// from core SDK
|
|
5013
|
+
delete event.breadcrumbs;
|
|
5014
|
+
return event;
|
|
5015
|
+
}
|
|
5015
5016
|
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5017
|
+
// We only want to handle errors & transactions, nothing else
|
|
5018
|
+
if (!isErrorEvent(event) && !isTransactionEvent(event)) {
|
|
5019
|
+
return event;
|
|
5020
|
+
}
|
|
5020
5021
|
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
}
|
|
5022
|
+
// Ensure we do not add replay_id if the session is expired
|
|
5023
|
+
const isSessionActive = replay.checkAndHandleExpiredSession();
|
|
5024
|
+
if (!isSessionActive) {
|
|
5025
|
+
return event;
|
|
5026
|
+
}
|
|
5027
5027
|
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5028
|
+
// Unless `captureExceptions` is enabled, we want to ignore errors coming from rrweb
|
|
5029
|
+
// As there can be a bunch of stuff going wrong in internals there, that we don't want to bubble up to users
|
|
5030
|
+
if (isRrwebError(event, hint) && !replay.getOptions()._experiments.captureExceptions) {
|
|
5031
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.log('[Replay] Ignoring error from rrweb internals', event);
|
|
5032
|
+
return null;
|
|
5033
|
+
}
|
|
5032
5034
|
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5035
|
+
// When in buffer mode, we decide to sample here.
|
|
5036
|
+
// Later, in `handleAfterSendEvent`, if the replayId is set, we know that we sampled
|
|
5037
|
+
// And convert the buffer session to a full session
|
|
5038
|
+
const isErrorEventSampled = shouldSampleForBufferEvent(replay, event);
|
|
5036
5039
|
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
+
// Tag errors if it has been sampled in buffer mode, or if it is session mode
|
|
5041
|
+
// Only tag transactions if in session mode
|
|
5042
|
+
const shouldTagReplayId = isErrorEventSampled || replay.recordingMode === 'session';
|
|
5040
5043
|
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
// Pretend the error had a 200 response so we always capture it
|
|
5045
|
-
afterSendHandler(event, { statusCode: 200 });
|
|
5046
|
-
}
|
|
5044
|
+
if (shouldTagReplayId) {
|
|
5045
|
+
event.tags = { ...event.tags, replayId: replay.getSessionId() };
|
|
5046
|
+
}
|
|
5047
5047
|
|
|
5048
|
-
|
|
5049
|
-
|
|
5048
|
+
// In cases where a custom client is used that does not support the new hooks (yet),
|
|
5049
|
+
// we manually call this hook method here
|
|
5050
|
+
if (afterSendHandler) {
|
|
5051
|
+
// Pretend the error had a 200 response so we always capture it
|
|
5052
|
+
afterSendHandler(event, { statusCode: 200 });
|
|
5053
|
+
}
|
|
5054
|
+
|
|
5055
|
+
return event;
|
|
5056
|
+
},
|
|
5057
|
+
{ id: 'Replay' },
|
|
5058
|
+
);
|
|
5050
5059
|
}
|
|
5051
5060
|
|
|
5052
5061
|
/**
|
|
@@ -6422,7 +6431,12 @@ function addGlobalListeners(replay) {
|
|
|
6422
6431
|
|
|
6423
6432
|
// Tag all (non replay) events that get sent to Sentry with the current
|
|
6424
6433
|
// replay ID so that we can reference them later in the UI
|
|
6425
|
-
|
|
6434
|
+
const eventProcessor = handleGlobalEventListener(replay, !hasHooks(client));
|
|
6435
|
+
if (client && client.addEventProcessor) {
|
|
6436
|
+
client.addEventProcessor(eventProcessor);
|
|
6437
|
+
} else {
|
|
6438
|
+
core.addGlobalEventProcessor(eventProcessor);
|
|
6439
|
+
}
|
|
6426
6440
|
|
|
6427
6441
|
// If a custom client has no hooks yet, we continue to use the "old" implementation
|
|
6428
6442
|
if (hasHooks(client)) {
|