@datadog/browser-rum-core
Advanced tools
Comparing version 5.15.0 to 5.16.0
@@ -73,3 +73,6 @@ "use strict"; | ||
*/ | ||
setTrackingConsent: (0, browser_core_1.monitor)(function (trackingConsent) { return trackingConsentState.update(trackingConsent); }), | ||
setTrackingConsent: (0, browser_core_1.monitor)(function (trackingConsent) { | ||
trackingConsentState.update(trackingConsent); | ||
(0, browser_core_1.addTelemetryUsage)({ feature: 'set-tracking-consent', tracking_consent: trackingConsent }); | ||
}), | ||
setGlobalContextProperty: (0, browser_core_1.monitor)(function (key, value) { return globalContextManager.setContextProperty(key, value); }), | ||
@@ -132,2 +135,3 @@ removeGlobalContextProperty: (0, browser_core_1.monitor)(function (key) { return globalContextManager.removeContextProperty(key); }), | ||
strategy.stopSession(); | ||
(0, browser_core_1.addTelemetryUsage)({ feature: 'stop-session' }); | ||
}), | ||
@@ -141,3 +145,6 @@ /** | ||
getSessionReplayLink: (0, browser_core_1.monitor)(function () { return recorderApi.getSessionReplayLink(); }), | ||
startSessionReplayRecording: (0, browser_core_1.monitor)(function () { return recorderApi.start(); }), | ||
startSessionReplayRecording: (0, browser_core_1.monitor)(function () { | ||
recorderApi.start(); | ||
(0, browser_core_1.addTelemetryUsage)({ feature: 'start-session-replay-recording' }); | ||
}), | ||
stopSessionReplayRecording: (0, browser_core_1.monitor)(function () { return recorderApi.stop(); }), | ||
@@ -144,0 +151,0 @@ }); |
@@ -59,3 +59,3 @@ "use strict"; | ||
}, | ||
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "5.15.0" : undefined, | ||
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "5.16.0" : undefined, | ||
}, | ||
@@ -62,0 +62,0 @@ application: { |
@@ -68,2 +68,3 @@ import type { Configuration, InitConfiguration, MatchOption } from '@datadog/browser-core'; | ||
telemetry_configuration_sample_rate: number | undefined; | ||
telemetry_usage_sample_rate: number | undefined; | ||
use_before_send: boolean; | ||
@@ -70,0 +71,0 @@ use_cross_site_session_cookie: boolean | undefined; |
@@ -49,3 +49,3 @@ "use strict"; | ||
status_code: request.status, | ||
url: request.url, | ||
url: (0, resourceUtils_1.isLongDataUrl)(request.url) ? (0, resourceUtils_1.sanitizeDataUrl)(request.url) : request.url, | ||
}, | ||
@@ -52,0 +52,0 @@ type: "resource" /* RumEventType.RESOURCE */, |
@@ -11,4 +11,4 @@ import type { ServerDuration } from '@datadog/browser-core'; | ||
ssl?: PerformanceResourceDetailsElement; | ||
first_byte: PerformanceResourceDetailsElement; | ||
download: PerformanceResourceDetailsElement; | ||
first_byte?: PerformanceResourceDetailsElement; | ||
download?: PerformanceResourceDetailsElement; | ||
} | ||
@@ -33,1 +33,4 @@ export declare const FAKE_INITIAL_DOCUMENT = "initial_document"; | ||
export declare function isAllowedRequestUrl(configuration: RumConfiguration, url: string): boolean | ""; | ||
export declare const MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24000; | ||
export declare function isLongDataUrl(url: string): boolean; | ||
export declare function sanitizeDataUrl(url: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isAllowedRequestUrl = exports.computeSize = exports.toValidEntry = exports.computePerformanceResourceDetails = exports.computePerformanceResourceDuration = exports.isRequestKind = exports.computeResourceKind = exports.FAKE_INITIAL_DOCUMENT = void 0; | ||
exports.sanitizeDataUrl = exports.isLongDataUrl = exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = exports.isAllowedRequestUrl = exports.computeSize = exports.toValidEntry = exports.computePerformanceResourceDetails = exports.computePerformanceResourceDuration = exports.isRequestKind = exports.computeResourceKind = exports.FAKE_INITIAL_DOCUMENT = void 0; | ||
var browser_core_1 = require("@datadog/browser-core"); | ||
@@ -79,6 +79,6 @@ exports.FAKE_INITIAL_DOCUMENT = 'initial_document'; | ||
// Make sure a connection occurred | ||
if (connectEnd !== fetchStart) { | ||
if (fetchStart < connectEnd) { | ||
details.connect = formatTiming(startTime, connectStart, connectEnd); | ||
// Make sure a secure connection occurred | ||
if (areInOrder(connectStart, secureConnectionStart, connectEnd)) { | ||
if (connectStart <= secureConnectionStart && secureConnectionStart <= connectEnd) { | ||
details.ssl = formatTiming(startTime, secureConnectionStart, connectEnd); | ||
@@ -88,6 +88,7 @@ } | ||
// Make sure a domain lookup occurred | ||
if (domainLookupEnd !== fetchStart) { | ||
if (fetchStart < domainLookupEnd) { | ||
details.dns = formatTiming(startTime, domainLookupStart, domainLookupEnd); | ||
} | ||
if (hasRedirection(entry)) { | ||
// Make sure a redirection occurred | ||
if (startTime < redirectEnd) { | ||
details.redirect = formatTiming(startTime, redirectStart, redirectEnd); | ||
@@ -99,2 +100,5 @@ } | ||
function toValidEntry(entry) { | ||
if ((0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.TOLERANT_RESOURCE_TIMINGS)) { | ||
return entry; | ||
} | ||
// Ensure timings are in the right order. On top of filtering out potential invalid | ||
@@ -117,6 +121,8 @@ // RumPerformanceResourceTiming, it will ignore entries from requests where timings cannot be | ||
function formatTiming(origin, start, end) { | ||
return { | ||
duration: (0, browser_core_1.toServerDuration)((0, browser_core_1.elapsed)(start, end)), | ||
start: (0, browser_core_1.toServerDuration)((0, browser_core_1.elapsed)(origin, start)), | ||
}; | ||
if (origin <= start && start <= end) { | ||
return { | ||
duration: (0, browser_core_1.toServerDuration)((0, browser_core_1.elapsed)(start, end)), | ||
start: (0, browser_core_1.toServerDuration)((0, browser_core_1.elapsed)(origin, start)), | ||
}; | ||
} | ||
} | ||
@@ -146,2 +152,20 @@ function computeSize(entry) { | ||
exports.isAllowedRequestUrl = isAllowedRequestUrl; | ||
var DATA_URL_REGEX = /data:(.+)?(;base64)?,/g; | ||
exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24000; | ||
function isLongDataUrl(url) { | ||
if (url.length <= exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH) { | ||
return false; | ||
} | ||
else if (url.substring(0, 5) === 'data:') { | ||
// Avoid String.match RangeError: Maximum call stack size exceeded | ||
url = url.substring(0, exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH); | ||
return true; | ||
} | ||
return false; | ||
} | ||
exports.isLongDataUrl = isLongDataUrl; | ||
function sanitizeDataUrl(url) { | ||
return "".concat(url.match(DATA_URL_REGEX)[0], "[...]"); | ||
} | ||
exports.sanitizeDataUrl = sanitizeDataUrl; | ||
//# sourceMappingURL=resourceUtils.js.map |
@@ -20,1 +20,2 @@ export { RumPublicApi, makeRumPublicApi, RecorderApi } from './boot/rumPublicApi'; | ||
export { getSessionReplayUrl } from './domain/getSessionReplayUrl'; | ||
export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils'; |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSessionReplayUrl = exports.STABLE_ATTRIBUTES = exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = exports.getScrollY = exports.getScrollX = exports.getViewportDimension = exports.initViewportObservable = exports.getMutationObserverConstructor = exports.startViewContexts = exports.LifeCycle = exports.startRum = exports.makeRumPublicApi = void 0; | ||
exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = exports.sanitizeDataUrl = exports.isLongDataUrl = exports.getSessionReplayUrl = exports.STABLE_ATTRIBUTES = exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = exports.getScrollY = exports.getScrollX = exports.getViewportDimension = exports.initViewportObservable = exports.getMutationObserverConstructor = exports.startViewContexts = exports.LifeCycle = exports.startRum = exports.makeRumPublicApi = void 0; | ||
var rumPublicApi_1 = require("./boot/rumPublicApi"); | ||
@@ -43,2 +43,6 @@ Object.defineProperty(exports, "makeRumPublicApi", { enumerable: true, get: function () { return rumPublicApi_1.makeRumPublicApi; } }); | ||
Object.defineProperty(exports, "getSessionReplayUrl", { enumerable: true, get: function () { return getSessionReplayUrl_1.getSessionReplayUrl; } }); | ||
var resourceUtils_1 = require("./domain/resource/resourceUtils"); | ||
Object.defineProperty(exports, "isLongDataUrl", { enumerable: true, get: function () { return resourceUtils_1.isLongDataUrl; } }); | ||
Object.defineProperty(exports, "sanitizeDataUrl", { enumerable: true, get: function () { return resourceUtils_1.sanitizeDataUrl; } }); | ||
Object.defineProperty(exports, "MAX_ATTRIBUTE_VALUE_CHAR_LENGTH", { enumerable: true, get: function () { return resourceUtils_1.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -364,2 +364,6 @@ /** | ||
}; | ||
/** | ||
* Time since application start when error happened (in milliseconds) | ||
*/ | ||
readonly time_since_app_start?: number; | ||
[k: string]: unknown; | ||
@@ -366,0 +370,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { timeStampToClocks, isExperimentalFeatureEnabled, ExperimentalFeature, assign, createContextManager, deepClone, makePublicApi, monitor, clocksNow, callMonitored, createHandlingStack, checkUser, sanitizeUser, sanitize, createIdentityEncoder, createCustomerDataTrackerManager, storeContextManager, displayAlreadyInitializedError, createTrackingConsentState, } from '@datadog/browser-core'; | ||
import { addTelemetryUsage, timeStampToClocks, isExperimentalFeatureEnabled, ExperimentalFeature, assign, createContextManager, deepClone, makePublicApi, monitor, clocksNow, callMonitored, createHandlingStack, checkUser, sanitizeUser, sanitize, createIdentityEncoder, createCustomerDataTrackerManager, storeContextManager, displayAlreadyInitializedError, createTrackingConsentState, } from '@datadog/browser-core'; | ||
import { buildCommonContext } from '../domain/contexts/commonContext'; | ||
@@ -70,3 +70,6 @@ import { createPreStartStrategy } from './preStartRum'; | ||
*/ | ||
setTrackingConsent: monitor(function (trackingConsent) { return trackingConsentState.update(trackingConsent); }), | ||
setTrackingConsent: monitor(function (trackingConsent) { | ||
trackingConsentState.update(trackingConsent); | ||
addTelemetryUsage({ feature: 'set-tracking-consent', tracking_consent: trackingConsent }); | ||
}), | ||
setGlobalContextProperty: monitor(function (key, value) { return globalContextManager.setContextProperty(key, value); }), | ||
@@ -129,2 +132,3 @@ removeGlobalContextProperty: monitor(function (key) { return globalContextManager.removeContextProperty(key); }), | ||
strategy.stopSession(); | ||
addTelemetryUsage({ feature: 'stop-session' }); | ||
}), | ||
@@ -138,3 +142,6 @@ /** | ||
getSessionReplayLink: monitor(function () { return recorderApi.getSessionReplayLink(); }), | ||
startSessionReplayRecording: monitor(function () { return recorderApi.start(); }), | ||
startSessionReplayRecording: monitor(function () { | ||
recorderApi.start(); | ||
addTelemetryUsage({ feature: 'start-session-replay-recording' }); | ||
}), | ||
stopSessionReplayRecording: monitor(function () { return recorderApi.stop(); }), | ||
@@ -141,0 +148,0 @@ }); |
@@ -56,3 +56,3 @@ import { combine, isEmptyObject, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, assign, round, isExperimentalFeatureEnabled, ExperimentalFeature, getConnectivity, } from '@datadog/browser-core'; | ||
}, | ||
browser_sdk_version: canUseEventBridge() ? "5.15.0" : undefined, | ||
browser_sdk_version: canUseEventBridge() ? "5.16.0" : undefined, | ||
}, | ||
@@ -59,0 +59,0 @@ application: { |
@@ -68,2 +68,3 @@ import type { Configuration, InitConfiguration, MatchOption } from '@datadog/browser-core'; | ||
telemetry_configuration_sample_rate: number | undefined; | ||
telemetry_usage_sample_rate: number | undefined; | ||
use_before_send: boolean; | ||
@@ -70,0 +71,0 @@ use_cross_site_session_cookie: boolean | undefined; |
import { combine, generateUUID, toServerDuration, relativeToClocks, assign, isNumber, isExperimentalFeatureEnabled, ExperimentalFeature, } from '@datadog/browser-core'; | ||
import { RumPerformanceEntryType } from '../../browser/performanceCollection'; | ||
import { matchRequestTiming } from './matchRequestTiming'; | ||
import { computePerformanceResourceDetails, computePerformanceResourceDuration, computeResourceKind, computeSize, isRequestKind, } from './resourceUtils'; | ||
import { computePerformanceResourceDetails, computePerformanceResourceDuration, computeResourceKind, computeSize, isRequestKind, isLongDataUrl, sanitizeDataUrl, } from './resourceUtils'; | ||
export function startResourceCollection(lifeCycle, configuration, sessionManager, pageStateHistory) { | ||
@@ -45,3 +45,3 @@ lifeCycle.subscribe(8 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) { | ||
status_code: request.status, | ||
url: request.url, | ||
url: isLongDataUrl(request.url) ? sanitizeDataUrl(request.url) : request.url, | ||
}, | ||
@@ -48,0 +48,0 @@ type: "resource" /* RumEventType.RESOURCE */, |
@@ -11,4 +11,4 @@ import type { ServerDuration } from '@datadog/browser-core'; | ||
ssl?: PerformanceResourceDetailsElement; | ||
first_byte: PerformanceResourceDetailsElement; | ||
download: PerformanceResourceDetailsElement; | ||
first_byte?: PerformanceResourceDetailsElement; | ||
download?: PerformanceResourceDetailsElement; | ||
} | ||
@@ -33,1 +33,4 @@ export declare const FAKE_INITIAL_DOCUMENT = "initial_document"; | ||
export declare function isAllowedRequestUrl(configuration: RumConfiguration, url: string): boolean | ""; | ||
export declare const MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24000; | ||
export declare function isLongDataUrl(url: string): boolean; | ||
export declare function sanitizeDataUrl(url: string): string; |
@@ -1,2 +0,2 @@ | ||
import { addTelemetryDebug, elapsed, getPathName, includes, isValidUrl, toServerDuration, } from '@datadog/browser-core'; | ||
import { addTelemetryDebug, elapsed, ExperimentalFeature, getPathName, includes, isExperimentalFeatureEnabled, isValidUrl, toServerDuration, } from '@datadog/browser-core'; | ||
export var FAKE_INITIAL_DOCUMENT = 'initial_document'; | ||
@@ -73,6 +73,6 @@ var RESOURCE_TYPES = [ | ||
// Make sure a connection occurred | ||
if (connectEnd !== fetchStart) { | ||
if (fetchStart < connectEnd) { | ||
details.connect = formatTiming(startTime, connectStart, connectEnd); | ||
// Make sure a secure connection occurred | ||
if (areInOrder(connectStart, secureConnectionStart, connectEnd)) { | ||
if (connectStart <= secureConnectionStart && secureConnectionStart <= connectEnd) { | ||
details.ssl = formatTiming(startTime, secureConnectionStart, connectEnd); | ||
@@ -82,6 +82,7 @@ } | ||
// Make sure a domain lookup occurred | ||
if (domainLookupEnd !== fetchStart) { | ||
if (fetchStart < domainLookupEnd) { | ||
details.dns = formatTiming(startTime, domainLookupStart, domainLookupEnd); | ||
} | ||
if (hasRedirection(entry)) { | ||
// Make sure a redirection occurred | ||
if (startTime < redirectEnd) { | ||
details.redirect = formatTiming(startTime, redirectStart, redirectEnd); | ||
@@ -92,2 +93,5 @@ } | ||
export function toValidEntry(entry) { | ||
if (isExperimentalFeatureEnabled(ExperimentalFeature.TOLERANT_RESOURCE_TIMINGS)) { | ||
return entry; | ||
} | ||
// Ensure timings are in the right order. On top of filtering out potential invalid | ||
@@ -109,6 +113,8 @@ // RumPerformanceResourceTiming, it will ignore entries from requests where timings cannot be | ||
function formatTiming(origin, start, end) { | ||
return { | ||
duration: toServerDuration(elapsed(start, end)), | ||
start: toServerDuration(elapsed(origin, start)), | ||
}; | ||
if (origin <= start && start <= end) { | ||
return { | ||
duration: toServerDuration(elapsed(start, end)), | ||
start: toServerDuration(elapsed(origin, start)), | ||
}; | ||
} | ||
} | ||
@@ -136,2 +142,18 @@ export function computeSize(entry) { | ||
} | ||
var DATA_URL_REGEX = /data:(.+)?(;base64)?,/g; | ||
export var MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24000; | ||
export function isLongDataUrl(url) { | ||
if (url.length <= MAX_ATTRIBUTE_VALUE_CHAR_LENGTH) { | ||
return false; | ||
} | ||
else if (url.substring(0, 5) === 'data:') { | ||
// Avoid String.match RangeError: Maximum call stack size exceeded | ||
url = url.substring(0, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH); | ||
return true; | ||
} | ||
return false; | ||
} | ||
export function sanitizeDataUrl(url) { | ||
return "".concat(url.match(DATA_URL_REGEX)[0], "[...]"); | ||
} | ||
//# sourceMappingURL=resourceUtils.js.map |
@@ -20,1 +20,2 @@ export { RumPublicApi, makeRumPublicApi, RecorderApi } from './boot/rumPublicApi'; | ||
export { getSessionReplayUrl } from './domain/getSessionReplayUrl'; | ||
export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils'; |
@@ -13,2 +13,3 @@ export { makeRumPublicApi } from './boot/rumPublicApi'; | ||
export { getSessionReplayUrl } from './domain/getSessionReplayUrl'; | ||
export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils'; | ||
//# sourceMappingURL=index.js.map |
@@ -364,2 +364,6 @@ /** | ||
}; | ||
/** | ||
* Time since application start when error happened (in milliseconds) | ||
*/ | ||
readonly time_since_app_start?: number; | ||
[k: string]: unknown; | ||
@@ -366,0 +370,0 @@ }; |
{ | ||
"name": "@datadog/browser-rum-core", | ||
"version": "5.15.0", | ||
"version": "5.16.0", | ||
"license": "Apache-2.0", | ||
@@ -15,3 +15,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@datadog/browser-core": "5.15.0" | ||
"@datadog/browser-core": "5.16.0" | ||
}, | ||
@@ -32,3 +32,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "fd98f96a13ff42717cdb9b28e4251a50e1976266" | ||
"gitHead": "7fd800d615f6e6a689597d064e709ac7fc0914ec" | ||
} |
@@ -12,2 +12,3 @@ import type { | ||
import { | ||
addTelemetryUsage, | ||
timeStampToClocks, | ||
@@ -208,3 +209,6 @@ isExperimentalFeatureEnabled, | ||
*/ | ||
setTrackingConsent: monitor((trackingConsent: TrackingConsent) => trackingConsentState.update(trackingConsent)), | ||
setTrackingConsent: monitor((trackingConsent: TrackingConsent) => { | ||
trackingConsentState.update(trackingConsent) | ||
addTelemetryUsage({ feature: 'set-tracking-consent', tracking_consent: trackingConsent }) | ||
}), | ||
@@ -283,2 +287,3 @@ setGlobalContextProperty: monitor((key, value) => globalContextManager.setContextProperty(key, value)), | ||
strategy.stopSession() | ||
addTelemetryUsage({ feature: 'stop-session' }) | ||
}), | ||
@@ -294,3 +299,6 @@ | ||
getSessionReplayLink: monitor(() => recorderApi.getSessionReplayLink()), | ||
startSessionReplayRecording: monitor(() => recorderApi.start()), | ||
startSessionReplayRecording: monitor(() => { | ||
recorderApi.start() | ||
addTelemetryUsage({ feature: 'start-session-replay-recording' }) | ||
}), | ||
stopSessionReplayRecording: monitor(() => recorderApi.stop()), | ||
@@ -297,0 +305,0 @@ }) |
@@ -20,4 +20,4 @@ import type { ClocksState, Duration } from '@datadog/browser-core' | ||
import { RumEventType } from '../../rawRumEvent.types' | ||
import type { LifeCycle, RawRumEventCollectedData } from '../lifeCycle' | ||
import { LifeCycleEventType } from '../lifeCycle' | ||
import type { RawRumEventCollectedData, LifeCycle } from '../lifeCycle' | ||
import type { RequestCompleteEvent } from '../requestCollection' | ||
@@ -34,2 +34,4 @@ import type { RumSessionManager } from '../rumSessionManager' | ||
isRequestKind, | ||
isLongDataUrl, | ||
sanitizeDataUrl, | ||
} from './resourceUtils' | ||
@@ -96,3 +98,3 @@ | ||
status_code: request.status, | ||
url: request.url, | ||
url: isLongDataUrl(request.url) ? sanitizeDataUrl(request.url) : request.url, | ||
}, | ||
@@ -99,0 +101,0 @@ type: RumEventType.RESOURCE as const, |
@@ -5,4 +5,6 @@ import type { RelativeTime, ServerDuration } from '@datadog/browser-core' | ||
elapsed, | ||
ExperimentalFeature, | ||
getPathName, | ||
includes, | ||
isExperimentalFeatureEnabled, | ||
isValidUrl, | ||
@@ -23,4 +25,4 @@ ResourceType, | ||
ssl?: PerformanceResourceDetailsElement | ||
first_byte: PerformanceResourceDetailsElement | ||
download: PerformanceResourceDetailsElement | ||
first_byte?: PerformanceResourceDetailsElement | ||
download?: PerformanceResourceDetailsElement | ||
} | ||
@@ -118,7 +120,7 @@ | ||
// Make sure a connection occurred | ||
if (connectEnd !== fetchStart) { | ||
if (fetchStart < connectEnd) { | ||
details.connect = formatTiming(startTime, connectStart, connectEnd) | ||
// Make sure a secure connection occurred | ||
if (areInOrder(connectStart, secureConnectionStart, connectEnd)) { | ||
if (connectStart <= secureConnectionStart && secureConnectionStart <= connectEnd) { | ||
details.ssl = formatTiming(startTime, secureConnectionStart, connectEnd) | ||
@@ -129,7 +131,8 @@ } | ||
// Make sure a domain lookup occurred | ||
if (domainLookupEnd !== fetchStart) { | ||
if (fetchStart < domainLookupEnd) { | ||
details.dns = formatTiming(startTime, domainLookupStart, domainLookupEnd) | ||
} | ||
if (hasRedirection(entry)) { | ||
// Make sure a redirection occurred | ||
if (startTime < redirectEnd) { | ||
details.redirect = formatTiming(startTime, redirectStart, redirectEnd) | ||
@@ -142,2 +145,6 @@ } | ||
export function toValidEntry(entry: RumPerformanceResourceTiming) { | ||
if (isExperimentalFeatureEnabled(ExperimentalFeature.TOLERANT_RESOURCE_TIMINGS)) { | ||
return entry | ||
} | ||
// Ensure timings are in the right order. On top of filtering out potential invalid | ||
@@ -171,7 +178,8 @@ // RumPerformanceResourceTiming, it will ignore entries from requests where timings cannot be | ||
} | ||
function formatTiming(origin: RelativeTime, start: RelativeTime, end: RelativeTime) { | ||
return { | ||
duration: toServerDuration(elapsed(start, end)), | ||
start: toServerDuration(elapsed(origin, start)), | ||
if (origin <= start && start <= end) { | ||
return { | ||
duration: toServerDuration(elapsed(start, end)), | ||
start: toServerDuration(elapsed(origin, start)), | ||
} | ||
} | ||
@@ -202,1 +210,19 @@ } | ||
} | ||
const DATA_URL_REGEX = /data:(.+)?(;base64)?,/g | ||
export const MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24_000 | ||
export function isLongDataUrl(url: string): boolean { | ||
if (url.length <= MAX_ATTRIBUTE_VALUE_CHAR_LENGTH) { | ||
return false | ||
} else if (url.substring(0, 5) === 'data:') { | ||
// Avoid String.match RangeError: Maximum call stack size exceeded | ||
url = url.substring(0, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH) | ||
return true | ||
} | ||
return false | ||
} | ||
export function sanitizeDataUrl(url: string): string { | ||
return `${url.match(DATA_URL_REGEX)![0]}[...]` | ||
} |
@@ -38,1 +38,2 @@ export { RumPublicApi, makeRumPublicApi, RecorderApi } from './boot/rumPublicApi' | ||
export { getSessionReplayUrl } from './domain/getSessionReplayUrl' | ||
export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils' |
@@ -398,2 +398,6 @@ /* eslint-disable */ | ||
} | ||
/** | ||
* Time since application start when error happened (in milliseconds) | ||
*/ | ||
readonly time_since_app_start?: number | ||
[k: string]: unknown | ||
@@ -400,0 +404,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1312230
23989
+ Added@datadog/browser-core@5.16.0(transitive)
- Removed@datadog/browser-core@5.15.0(transitive)
Updated@datadog/browser-core@5.16.0