@datadog/browser-rum-core
Advanced tools
Comparing version 4.20.0 to 4.21.0
@@ -62,3 +62,2 @@ import type { Duration, RelativeTime } from '@datadog/browser-core'; | ||
export declare function supportPerformanceTimingEvent(entryType: string): boolean; | ||
export declare function supportPerformanceEntry(): boolean; | ||
export declare function startPerformanceCollection(lifeCycle: LifeCycle, configuration: RumConfiguration): void; | ||
@@ -65,0 +64,0 @@ export declare function retrieveInitialDocumentResourceTiming(callback: (timing: RumPerformanceResourceTiming) => void): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.retrieveInitialDocumentResourceTiming = exports.startPerformanceCollection = exports.supportPerformanceEntry = exports.supportPerformanceTimingEvent = void 0; | ||
exports.retrieveInitialDocumentResourceTiming = exports.startPerformanceCollection = exports.supportPerformanceTimingEvent = void 0; | ||
var browser_core_1 = require("@datadog/browser-core"); | ||
@@ -16,7 +16,2 @@ var resourceUtils_1 = require("../domain/rumEventsCollection/resource/resourceUtils"); | ||
exports.supportPerformanceTimingEvent = supportPerformanceTimingEvent; | ||
function supportPerformanceEntry() { | ||
// Safari 10 doesn't support PerformanceEntry | ||
return typeof PerformanceEntry === 'function'; | ||
} | ||
exports.supportPerformanceEntry = supportPerformanceEntry; | ||
function startPerformanceCollection(lifeCycle, configuration) { | ||
@@ -23,0 +18,0 @@ retrieveInitialDocumentResourceTiming(function (timing) { |
@@ -48,3 +48,3 @@ "use strict"; | ||
}, | ||
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "4.20.0" : undefined, | ||
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "4.21.0" : undefined, | ||
}, | ||
@@ -51,0 +51,0 @@ application: { |
@@ -27,3 +27,12 @@ "use strict"; | ||
var error = _a.error, handlingStack = _a.handlingStack, startClocks = _a.startClocks, customerContext = _a.context; | ||
var rawError = computeRawError(error, handlingStack, startClocks); | ||
var stackTrace = error instanceof Error ? (0, browser_core_1.computeStackTrace)(error) : undefined; | ||
var rawError = (0, browser_core_1.computeRawError)({ | ||
stackTrace: stackTrace, | ||
originalError: error, | ||
handlingStack: handlingStack, | ||
startClocks: startClocks, | ||
nonErrorPrefix: 'Provided', | ||
source: browser_core_1.ErrorSource.CUSTOM, | ||
handling: "handled" /* HANDLED */, | ||
}); | ||
lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { | ||
@@ -38,11 +47,2 @@ customerContext: customerContext, | ||
exports.doStartErrorCollection = doStartErrorCollection; | ||
function computeRawError(error, handlingStack, startClocks) { | ||
var stackTrace = error instanceof Error ? (0, browser_core_1.computeStackTrace)(error) : undefined; | ||
return (0, browser_core_1.assign)({ | ||
startClocks: startClocks, | ||
source: browser_core_1.ErrorSource.CUSTOM, | ||
originalError: error, | ||
handling: "handled" /* HANDLED */, | ||
}, (0, browser_core_1.formatUnknownError)(stackTrace, error, 'Provided', handlingStack)); | ||
} | ||
function processError(error, foregroundContexts) { | ||
@@ -59,2 +59,3 @@ var rawRumEvent = { | ||
handling: error.handling, | ||
causes: error.causes, | ||
source_type: 'browser', | ||
@@ -61,0 +62,0 @@ }, |
@@ -5,3 +5,2 @@ "use strict"; | ||
var browser_core_1 = require("@datadog/browser-core"); | ||
var performanceCollection_1 = require("../../../browser/performanceCollection"); | ||
var matchRequestTiming_1 = require("./matchRequestTiming"); | ||
@@ -111,6 +110,4 @@ var resourceUtils_1 = require("./resourceUtils"); | ||
} | ||
// TODO next major: use directly PerformanceEntry type in domain context | ||
function toPerformanceEntryRepresentation(entry) { | ||
if ((0, performanceCollection_1.supportPerformanceEntry)() && entry instanceof PerformanceEntry) { | ||
entry.toJSON(); | ||
} | ||
return entry; | ||
@@ -117,0 +114,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core'; | ||
import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, RawErrorCause } from '@datadog/browser-core'; | ||
import type { RumSessionPlan } from './domain/rumSessionManager'; | ||
@@ -50,2 +50,3 @@ export declare const enum RumEventType { | ||
handling?: ErrorHandling; | ||
causes?: RawErrorCause[]; | ||
source_type: 'browser'; | ||
@@ -52,0 +53,0 @@ }; |
@@ -62,3 +62,2 @@ import type { Duration, RelativeTime } from '@datadog/browser-core'; | ||
export declare function supportPerformanceTimingEvent(entryType: string): boolean; | ||
export declare function supportPerformanceEntry(): boolean; | ||
export declare function startPerformanceCollection(lifeCycle: LifeCycle, configuration: RumConfiguration): void; | ||
@@ -65,0 +64,0 @@ export declare function retrieveInitialDocumentResourceTiming(callback: (timing: RumPerformanceResourceTiming) => void): void; |
@@ -12,6 +12,2 @@ import { dateNow, assign, addEventListeners, getRelativeTime, isNumber, monitor, relativeNow, runOnReadyState, } from '@datadog/browser-core'; | ||
} | ||
export function supportPerformanceEntry() { | ||
// Safari 10 doesn't support PerformanceEntry | ||
return typeof PerformanceEntry === 'function'; | ||
} | ||
export function startPerformanceCollection(lifeCycle, configuration) { | ||
@@ -18,0 +14,0 @@ retrieveInitialDocumentResourceTiming(function (timing) { |
@@ -45,3 +45,3 @@ import { combine, isEmptyObject, limitModification, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, } from '@datadog/browser-core'; | ||
}, | ||
browser_sdk_version: canUseEventBridge() ? "4.20.0" : undefined, | ||
browser_sdk_version: canUseEventBridge() ? "4.21.0" : undefined, | ||
}, | ||
@@ -48,0 +48,0 @@ application: { |
@@ -1,2 +0,2 @@ | ||
import { assign, computeStackTrace, formatUnknownError, ErrorSource, generateUUID, Observable, trackRuntimeError, } from '@datadog/browser-core'; | ||
import { assign, ErrorSource, generateUUID, computeRawError, computeStackTrace, Observable, trackRuntimeError, } from '@datadog/browser-core'; | ||
import { trackConsoleError } from './trackConsoleError'; | ||
@@ -23,3 +23,12 @@ import { trackReportError } from './trackReportError'; | ||
var error = _a.error, handlingStack = _a.handlingStack, startClocks = _a.startClocks, customerContext = _a.context; | ||
var rawError = computeRawError(error, handlingStack, startClocks); | ||
var stackTrace = error instanceof Error ? computeStackTrace(error) : undefined; | ||
var rawError = computeRawError({ | ||
stackTrace: stackTrace, | ||
originalError: error, | ||
handlingStack: handlingStack, | ||
startClocks: startClocks, | ||
nonErrorPrefix: 'Provided', | ||
source: ErrorSource.CUSTOM, | ||
handling: "handled" /* HANDLED */, | ||
}); | ||
lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { | ||
@@ -33,11 +42,2 @@ customerContext: customerContext, | ||
} | ||
function computeRawError(error, handlingStack, startClocks) { | ||
var stackTrace = error instanceof Error ? computeStackTrace(error) : undefined; | ||
return assign({ | ||
startClocks: startClocks, | ||
source: ErrorSource.CUSTOM, | ||
originalError: error, | ||
handling: "handled" /* HANDLED */, | ||
}, formatUnknownError(stackTrace, error, 'Provided', handlingStack)); | ||
} | ||
function processError(error, foregroundContexts) { | ||
@@ -54,2 +54,3 @@ var rawRumEvent = { | ||
handling: error.handling, | ||
causes: error.causes, | ||
source_type: 'browser', | ||
@@ -56,0 +57,0 @@ }, |
import { combine, generateUUID, toServerDuration, relativeToClocks, assign, isNumber, } from '@datadog/browser-core'; | ||
import { supportPerformanceEntry } from '../../../browser/performanceCollection'; | ||
import { matchRequestTiming } from './matchRequestTiming'; | ||
@@ -106,6 +105,4 @@ import { computePerformanceResourceDetails, computePerformanceResourceDuration, computeResourceKind, computeSize, isRequestKind, } from './resourceUtils'; | ||
} | ||
// TODO next major: use directly PerformanceEntry type in domain context | ||
function toPerformanceEntryRepresentation(entry) { | ||
if (supportPerformanceEntry() && entry instanceof PerformanceEntry) { | ||
entry.toJSON(); | ||
} | ||
return entry; | ||
@@ -112,0 +109,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core'; | ||
import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, RawErrorCause } from '@datadog/browser-core'; | ||
import type { RumSessionPlan } from './domain/rumSessionManager'; | ||
@@ -50,2 +50,3 @@ export declare const enum RumEventType { | ||
handling?: ErrorHandling; | ||
causes?: RawErrorCause[]; | ||
source_type: 'browser'; | ||
@@ -52,0 +53,0 @@ }; |
{ | ||
"name": "@datadog/browser-rum-core", | ||
"version": "4.20.0", | ||
"version": "4.21.0", | ||
"license": "Apache-2.0", | ||
@@ -15,3 +15,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@datadog/browser-core": "4.20.0" | ||
"@datadog/browser-core": "4.21.0" | ||
}, | ||
@@ -26,3 +26,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "7e174f276cf7b000981de8f38764ef0e07f73634" | ||
"gitHead": "15c8930f500f00a3d9ed98be0b3bbee608b63170" | ||
} |
@@ -105,7 +105,2 @@ import type { Duration, RelativeTime, TimeStamp } from '@datadog/browser-core' | ||
export function supportPerformanceEntry() { | ||
// Safari 10 doesn't support PerformanceEntry | ||
return typeof PerformanceEntry === 'function' | ||
} | ||
export function startPerformanceCollection(lifeCycle: LifeCycle, configuration: RumConfiguration) { | ||
@@ -112,0 +107,0 @@ retrieveInitialDocumentResourceTiming((timing) => { |
@@ -1,5 +0,6 @@ | ||
import type { RelativeTime, TimeStamp } from '@datadog/browser-core' | ||
import type { RelativeTime, TimeStamp, ErrorWithCause } from '@datadog/browser-core' | ||
import { ErrorHandling, ErrorSource } from '@datadog/browser-core' | ||
import type { TestSetupBuilder } from '../../../../test/specHelper' | ||
import { setup } from '../../../../test/specHelper' | ||
import type { RawRumErrorEvent } from '../../../rawRumEvent.types' | ||
import { RumEventType } from '../../../rawRumEvent.types' | ||
@@ -52,2 +53,3 @@ import { LifeCycleEventType } from '../../lifeCycle' | ||
source_type: 'browser', | ||
causes: undefined, | ||
}, | ||
@@ -65,2 +67,27 @@ type: RumEventType.ERROR, | ||
it('should extract causes from error', () => { | ||
const { rawRumEvents } = setupBuilder.build() | ||
const error1 = new Error('foo') as ErrorWithCause | ||
const error2 = new Error('bar') as ErrorWithCause | ||
const error3 = new Error('biz') as ErrorWithCause | ||
error1.cause = error2 | ||
error2.cause = error3 | ||
addError({ | ||
error: error1, | ||
handlingStack: 'Error: handling foo', | ||
startClocks: { relative: 1234 as RelativeTime, timeStamp: 123456789 as TimeStamp }, | ||
}) | ||
const { error } = rawRumEvents[0].rawRumEvent as RawRumErrorEvent | ||
expect(error.message).toEqual('foo') | ||
expect(error.source).toEqual(ErrorSource.CUSTOM) | ||
expect(error?.causes?.length).toEqual(2) | ||
expect(error?.causes?.[0].message).toEqual('bar') | ||
expect(error?.causes?.[0].source).toEqual(ErrorSource.CUSTOM) | ||
expect(error?.causes?.[1].message).toEqual('biz') | ||
expect(error?.causes?.[1].source).toEqual(ErrorSource.CUSTOM) | ||
}) | ||
it('should save the specified customer context', () => { | ||
@@ -149,2 +176,3 @@ const { rawRumEvents } = setupBuilder.build() | ||
source_type: 'browser', | ||
causes: undefined, | ||
}, | ||
@@ -151,0 +179,0 @@ view: { |
import type { Context, RawError, ClocksState } from '@datadog/browser-core' | ||
import { | ||
assign, | ||
computeStackTrace, | ||
formatUnknownError, | ||
ErrorSource, | ||
generateUUID, | ||
computeRawError, | ||
ErrorHandling, | ||
computeStackTrace, | ||
Observable, | ||
@@ -58,3 +58,13 @@ trackRuntimeError, | ||
) => { | ||
const rawError = computeRawError(error, handlingStack, startClocks) | ||
const stackTrace = error instanceof Error ? computeStackTrace(error) : undefined | ||
const rawError = computeRawError({ | ||
stackTrace, | ||
originalError: error, | ||
handlingStack, | ||
startClocks, | ||
nonErrorPrefix: 'Provided', | ||
source: ErrorSource.CUSTOM, | ||
handling: ErrorHandling.HANDLED, | ||
}) | ||
lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { | ||
@@ -69,15 +79,2 @@ customerContext, | ||
function computeRawError(error: unknown, handlingStack: string, startClocks: ClocksState): RawError { | ||
const stackTrace = error instanceof Error ? computeStackTrace(error) : undefined | ||
return assign( | ||
{ | ||
startClocks, | ||
source: ErrorSource.CUSTOM, | ||
originalError: error, | ||
handling: ErrorHandling.HANDLED, | ||
}, | ||
formatUnknownError(stackTrace, error, 'Provided', handlingStack) | ||
) | ||
} | ||
function processError( | ||
@@ -97,2 +94,3 @@ error: RawError, | ||
handling: error.handling, | ||
causes: error.causes, | ||
source_type: 'browser', | ||
@@ -99,0 +97,0 @@ }, |
@@ -14,3 +14,2 @@ import { | ||
import type { RumPerformanceEntry, RumPerformanceResourceTiming } from '../../../browser/performanceCollection' | ||
import { supportPerformanceEntry } from '../../../browser/performanceCollection' | ||
import type { | ||
@@ -176,6 +175,4 @@ PerformanceEntryRepresentation, | ||
// TODO next major: use directly PerformanceEntry type in domain context | ||
function toPerformanceEntryRepresentation(entry: RumPerformanceEntry): PerformanceEntryRepresentation { | ||
if (supportPerformanceEntry() && entry instanceof PerformanceEntry) { | ||
entry.toJSON() | ||
} | ||
return entry as PerformanceEntryRepresentation | ||
@@ -182,0 +179,0 @@ } |
@@ -9,2 +9,3 @@ import type { | ||
TimeStamp, | ||
RawErrorCause, | ||
} from '@datadog/browser-core' | ||
@@ -63,2 +64,3 @@ import type { RumSessionPlan } from './domain/rumSessionManager' | ||
handling?: ErrorHandling | ||
causes?: RawErrorCause[] | ||
source_type: 'browser' | ||
@@ -65,0 +67,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
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
25203
1229290
+ Added@datadog/browser-core@4.21.0(transitive)
- Removed@datadog/browser-core@4.20.0(transitive)
Updated@datadog/browser-core@4.21.0