@sentry/replay 10.60.0 → 10.61.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/build/npm/cjs/index.js +24 -3
- package/build/npm/cjs/index.js.map +1 -1
- package/build/npm/esm/index.js +25 -4
- package/build/npm/esm/index.js.map +1 -1
- package/build/npm/esm/package.json +1 -1
- package/build/npm/types/coreHandlers/handleAfterSegmentSpanEnd.d.ts +6 -0
- package/build/npm/types/coreHandlers/handleAfterSegmentSpanEnd.d.ts.map +1 -0
- package/build/npm/types/coreHandlers/handleAfterSendEvent.d.ts.map +1 -1
- package/build/npm/types/coreHandlers/util/addTraceIdToContext.d.ts +3 -0
- package/build/npm/types/coreHandlers/util/addTraceIdToContext.d.ts.map +1 -0
- package/build/npm/types/util/addGlobalListeners.d.ts.map +1 -1
- package/build/npm/types-ts3.8/coreHandlers/handleAfterSegmentSpanEnd.d.ts +6 -0
- package/build/npm/types-ts3.8/coreHandlers/util/addTraceIdToContext.d.ts +3 -0
- package/package.json +4 -4
package/build/npm/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GLOBAL_OBJ, normalize, fill, browserPerformanceTimeOrigin, debug as debug$1, severityLevelFromString, captureException, addBreadcrumb, uuid4, getClient, getLocationHref, getCurrentScope, getActiveSpan, getDynamicSamplingContextFromSpan, isSentryRequestUrl, stringMatchesSomePattern, addEventProcessor, debounce as debounce$1, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, prepareEvent, getIsolationScope, updateRateLimits, isRateLimited, setContext, getRootSpan, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, isBrowser, safeSetSpanJSONAttributes, parseSampleRate, consoleSandbox } from '@sentry/core';
|
|
1
|
+
import { GLOBAL_OBJ, normalize, fill, browserPerformanceTimeOrigin, debug as debug$1, severityLevelFromString, captureException, addBreadcrumb, uuid4, getClient, spanIsSampled, getLocationHref, getCurrentScope, getActiveSpan, getDynamicSamplingContextFromSpan, isSentryRequestUrl, stringMatchesSomePattern, addEventProcessor, debounce as debounce$1, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, prepareEvent, getIsolationScope, updateRateLimits, isRateLimited, setContext, getRootSpan, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, isBrowser, safeSetSpanJSONAttributes, parseSampleRate, consoleSandbox } from '@sentry/core';
|
|
2
2
|
import { setTimeout as setTimeout$3, htmlTreeAsString, addPerformanceInstrumentationHandler, addLcpInstrumentationHandler, addClsInstrumentationHandler, addInpInstrumentationHandler, serializeFormData, getFetchRequestArgBody, getBodyString, SENTRY_XHR_DATA_KEY, parseXhrResponseHeaders, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler } from '@sentry/browser-utils';
|
|
3
3
|
|
|
4
4
|
const WINDOW = GLOBAL_OBJ;
|
|
@@ -5867,6 +5867,26 @@ function maybeApplyCallback(event, callback) {
|
|
|
5867
5867
|
return event;
|
|
5868
5868
|
}
|
|
5869
5869
|
|
|
5870
|
+
const MAX_TRACE_IDS = 100;
|
|
5871
|
+
function addTraceIdToContext(replay, traceId) {
|
|
5872
|
+
const replayContext = replay.getContext();
|
|
5873
|
+
if (replayContext.traceIds.size < MAX_TRACE_IDS) {
|
|
5874
|
+
replayContext.traceIds.add(traceId);
|
|
5875
|
+
}
|
|
5876
|
+
}
|
|
5877
|
+
|
|
5878
|
+
function handleAfterSegmentSpanEnd(replay) {
|
|
5879
|
+
return (segmentSpan) => {
|
|
5880
|
+
if (!replay.isEnabled() || !spanIsSampled(segmentSpan)) {
|
|
5881
|
+
return;
|
|
5882
|
+
}
|
|
5883
|
+
const traceId = segmentSpan.spanContext().traceId;
|
|
5884
|
+
if (traceId) {
|
|
5885
|
+
addTraceIdToContext(replay, traceId);
|
|
5886
|
+
}
|
|
5887
|
+
};
|
|
5888
|
+
}
|
|
5889
|
+
|
|
5870
5890
|
function isErrorEvent(event) {
|
|
5871
5891
|
return !event.type;
|
|
5872
5892
|
}
|
|
@@ -5897,9 +5917,9 @@ function handleAfterSendEvent(replay) {
|
|
|
5897
5917
|
};
|
|
5898
5918
|
}
|
|
5899
5919
|
function handleTransactionEvent(replay, event) {
|
|
5900
|
-
const
|
|
5901
|
-
if (
|
|
5902
|
-
|
|
5920
|
+
const traceId = event.contexts?.trace?.trace_id;
|
|
5921
|
+
if (traceId) {
|
|
5922
|
+
addTraceIdToContext(replay, traceId);
|
|
5903
5923
|
}
|
|
5904
5924
|
}
|
|
5905
5925
|
function handleErrorEvent(replay, event) {
|
|
@@ -6759,6 +6779,7 @@ function addGlobalListeners(replay) {
|
|
|
6759
6779
|
}
|
|
6760
6780
|
}
|
|
6761
6781
|
});
|
|
6782
|
+
client.on("afterSegmentSpanEnd", handleAfterSegmentSpanEnd(replay));
|
|
6762
6783
|
client.on("spanStart", (span) => {
|
|
6763
6784
|
replay.lastActiveSpan = span;
|
|
6764
6785
|
});
|