@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/esm/index.js
CHANGED
|
@@ -4998,53 +4998,62 @@ 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
|
+
// Ensure we do not add replay_id if the session is expired
|
|
5021
|
+
const isSessionActive = replay.checkAndHandleExpiredSession();
|
|
5022
|
+
if (!isSessionActive) {
|
|
5023
|
+
return event;
|
|
5024
|
+
}
|
|
5025
5025
|
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5026
|
+
// Unless `captureExceptions` is enabled, we want to ignore errors coming from rrweb
|
|
5027
|
+
// As there can be a bunch of stuff going wrong in internals there, that we don't want to bubble up to users
|
|
5028
|
+
if (isRrwebError(event, hint) && !replay.getOptions()._experiments.captureExceptions) {
|
|
5029
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('[Replay] Ignoring error from rrweb internals', event);
|
|
5030
|
+
return null;
|
|
5031
|
+
}
|
|
5030
5032
|
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5033
|
+
// When in buffer mode, we decide to sample here.
|
|
5034
|
+
// Later, in `handleAfterSendEvent`, if the replayId is set, we know that we sampled
|
|
5035
|
+
// And convert the buffer session to a full session
|
|
5036
|
+
const isErrorEventSampled = shouldSampleForBufferEvent(replay, event);
|
|
5034
5037
|
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
+
// Tag errors if it has been sampled in buffer mode, or if it is session mode
|
|
5039
|
+
// Only tag transactions if in session mode
|
|
5040
|
+
const shouldTagReplayId = isErrorEventSampled || replay.recordingMode === 'session';
|
|
5038
5041
|
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
// Pretend the error had a 200 response so we always capture it
|
|
5043
|
-
afterSendHandler(event, { statusCode: 200 });
|
|
5044
|
-
}
|
|
5042
|
+
if (shouldTagReplayId) {
|
|
5043
|
+
event.tags = { ...event.tags, replayId: replay.getSessionId() };
|
|
5044
|
+
}
|
|
5045
5045
|
|
|
5046
|
-
|
|
5047
|
-
|
|
5046
|
+
// In cases where a custom client is used that does not support the new hooks (yet),
|
|
5047
|
+
// we manually call this hook method here
|
|
5048
|
+
if (afterSendHandler) {
|
|
5049
|
+
// Pretend the error had a 200 response so we always capture it
|
|
5050
|
+
afterSendHandler(event, { statusCode: 200 });
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
return event;
|
|
5054
|
+
},
|
|
5055
|
+
{ id: 'Replay' },
|
|
5056
|
+
);
|
|
5048
5057
|
}
|
|
5049
5058
|
|
|
5050
5059
|
/**
|
|
@@ -6420,7 +6429,12 @@ function addGlobalListeners(replay) {
|
|
|
6420
6429
|
|
|
6421
6430
|
// Tag all (non replay) events that get sent to Sentry with the current
|
|
6422
6431
|
// replay ID so that we can reference them later in the UI
|
|
6423
|
-
|
|
6432
|
+
const eventProcessor = handleGlobalEventListener(replay, !hasHooks(client));
|
|
6433
|
+
if (client && client.addEventProcessor) {
|
|
6434
|
+
client.addEventProcessor(eventProcessor);
|
|
6435
|
+
} else {
|
|
6436
|
+
addGlobalEventProcessor(eventProcessor);
|
|
6437
|
+
}
|
|
6424
6438
|
|
|
6425
6439
|
// If a custom client has no hooks yet, we continue to use the "old" implementation
|
|
6426
6440
|
if (hasHooks(client)) {
|