@datadog/browser-rum-core
Advanced tools
Comparing version 6.1.0 to 6.2.0
@@ -51,10 +51,16 @@ "use strict"; | ||
strategy.setViewName(name); | ||
(0, browser_core_1.addTelemetryUsage)({ feature: 'set-view-name' }); | ||
}), | ||
setViewContext: (0, browser_core_1.monitor)((context) => { | ||
strategy.setViewContext(context); | ||
(0, browser_core_1.addTelemetryUsage)({ feature: 'set-view-context' }); | ||
}), | ||
setViewContextProperty: (0, browser_core_1.monitor)((key, value) => { | ||
strategy.setViewContextProperty(key, value); | ||
(0, browser_core_1.addTelemetryUsage)({ feature: 'set-view-context-property' }); | ||
}), | ||
getViewContext: (0, browser_core_1.monitor)(() => strategy.getViewContext()), | ||
getViewContext: (0, browser_core_1.monitor)(() => { | ||
(0, browser_core_1.addTelemetryUsage)({ feature: 'set-view-context-property' }); | ||
return strategy.getViewContext(); | ||
}), | ||
setGlobalContext: (0, browser_core_1.monitor)((context) => { | ||
@@ -61,0 +67,0 @@ globalContextManager.setContext(context); |
@@ -39,2 +39,4 @@ import type { Observable, RawError, DeflateEncoderStreamId, Encoder, CustomerDataTrackerManager, TrackingConsentState } from '@datadog/browser-core'; | ||
findUrl: (startTime?: import("@datadog/browser-core").RelativeTime) => import("../domain/contexts/urlContexts").UrlContext | undefined; | ||
getAllEntries: () => import("@datadog/browser-core").Context[]; | ||
getDeletedEntries: () => import("@datadog/browser-core").RelativeTime[]; | ||
stop: () => void; | ||
@@ -41,0 +43,0 @@ }; |
@@ -39,3 +39,3 @@ "use strict"; | ||
const lifeCycle = new lifeCycle_1.LifeCycle(); | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => (0, browser_core_1.sendToExtension)('rum', event)); | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => (0, browser_core_1.sendToExtension)('rum', event)); | ||
const telemetry = startRumTelemetry(configuration); | ||
@@ -60,3 +60,3 @@ telemetry.setContextProvider(() => { | ||
const reportError = (error) => { | ||
lifeCycle.notify(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error }); | ||
lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error }); | ||
(0, browser_core_1.addTelemetryDebug)('Error reported to customer', { 'error.message': error.message }); | ||
@@ -67,3 +67,3 @@ }; | ||
const pageExitSubscription = pageExitObservable.subscribe((event) => { | ||
lifeCycle.notify(10 /* LifeCycleEventType.PAGE_EXITED */, event); | ||
lifeCycle.notify(11 /* LifeCycleEventType.PAGE_EXITED */, event); | ||
}); | ||
@@ -70,0 +70,0 @@ cleanupTasks.push(() => pageExitSubscription.unsubscribe()); |
@@ -66,2 +66,3 @@ import type { Duration, RelativeTime } from '@datadog/browser-core'; | ||
startTime: RelativeTime; | ||
toJSON(): Omit<RumPerformancePaintTiming, 'toJSON'>; | ||
} | ||
@@ -83,2 +84,3 @@ export interface RumPerformanceNavigationTiming extends Omit<RumPerformanceResourceTiming, 'entryType'> { | ||
element?: Element; | ||
url?: string; | ||
toJSON(): Omit<RumLargestContentfulPaintTiming, 'toJSON'>; | ||
@@ -94,3 +96,3 @@ } | ||
interactionId?: number; | ||
name: string; | ||
toJSON(): Omit<RumFirstInputTiming, 'toJSON'>; | ||
} | ||
@@ -106,2 +108,3 @@ export interface RumPerformanceEventTiming { | ||
name: string; | ||
toJSON(): Omit<RumPerformanceEventTiming, 'toJSON'>; | ||
} | ||
@@ -119,2 +122,3 @@ export interface RumLayoutShiftAttribution { | ||
sources: RumLayoutShiftAttribution[]; | ||
toJSON(): Omit<RumLayoutShiftTiming, 'toJSON'>; | ||
} | ||
@@ -147,2 +151,3 @@ export type RumPerformanceScriptTiming = { | ||
styleAndLayoutStart: RelativeTime; | ||
toJSON(): Omit<RumPerformanceLongAnimationFrameTiming, 'toJSON'>; | ||
} | ||
@@ -149,0 +154,0 @@ export type RumPerformanceEntry = RumPerformanceResourceTiming | RumPerformanceLongTaskTiming | RumPerformanceLongAnimationFrameTiming | RumPerformancePaintTiming | RumPerformanceNavigationTiming | RumLargestContentfulPaintTiming | RumFirstInputTiming | RumPerformanceEventTiming | RumLayoutShiftTiming; |
@@ -20,3 +20,3 @@ "use strict"; | ||
startTime: 0, | ||
duration: timings.responseEnd, | ||
duration: timings.loadEventEnd, | ||
decodedBodySize: 0, | ||
@@ -23,0 +23,0 @@ encodedBodySize: 0, |
@@ -8,3 +8,3 @@ "use strict"; | ||
function startActionCollection(lifeCycle, domMutationObservable, windowOpenObservable, configuration, pageStateHistory) { | ||
lifeCycle.subscribe(0 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, (action) => lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processAction(action, pageStateHistory))); | ||
lifeCycle.subscribe(0 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, (action) => lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processAction(action, pageStateHistory))); | ||
let actionContexts = { findActionId: browser_core_1.noop }; | ||
@@ -18,3 +18,3 @@ let stop = browser_core_1.noop; | ||
addAction: (action, savedCommonContext) => { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
savedCommonContext, | ||
@@ -21,0 +21,0 @@ ...processAction(action, pageStateHistory), |
@@ -21,6 +21,6 @@ "use strict"; | ||
let currentClickChain; | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
history.reset(); | ||
}); | ||
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, stopClickChain); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.VIEW_ENDED */, stopClickChain); | ||
const { stop: stopActionEventsListener } = (0, listenActionEvents_1.listenActionEvents)(configuration, { | ||
@@ -102,3 +102,3 @@ onPointerDown: (pointerDownEvent) => processPointerDown(configuration, lifeCycle, domMutationObservable, pointerDownEvent, windowOpenObservable), | ||
}, interactionSelectorCache_1.CLICK_ACTION_MAX_DURATION); | ||
const viewEndedSubscription = lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, ({ endClocks }) => { | ||
const viewEndedSubscription = lifeCycle.subscribe(5 /* LifeCycleEventType.VIEW_ENDED */, ({ endClocks }) => { | ||
click.stop(endClocks.timeStamp); | ||
@@ -105,0 +105,0 @@ }); |
@@ -62,6 +62,21 @@ "use strict"; | ||
const syntheticsContext = (0, syntheticsContext_1.getSyntheticsContext)(); | ||
lifeCycle.subscribe(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, ({ startTime, rawRumEvent, domainContext, savedCommonContext, customerContext }) => { | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, ({ startTime, rawRumEvent, domainContext, savedCommonContext, customerContext }) => { | ||
const viewHistoryEntry = viewHistory.findView(startTime); | ||
const urlContext = urlContexts.findUrl(startTime); | ||
const session = sessionManager.findTrackedSession(startTime); | ||
if (session && | ||
viewHistoryEntry && | ||
!urlContext && | ||
(0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.MISSING_URL_CONTEXT_TELEMETRY)) { | ||
(0, browser_core_1.addTelemetryDebug)('Missing URL entry', { | ||
debug: { | ||
eventType: rawRumEvent.type, | ||
startTime, | ||
urlEntries: urlContexts.getAllEntries(), | ||
urlDeletedEntries: urlContexts.getDeletedEntries(), | ||
viewEntries: viewHistory.getAllEntries(), | ||
viewDeletedEntries: viewHistory.getDeletedEntries(), | ||
}, | ||
}); | ||
} | ||
if (session && viewHistoryEntry && urlContext) { | ||
@@ -78,3 +93,3 @@ const commonContext = savedCommonContext || getCommonContext(); | ||
}, | ||
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "6.1.0" : undefined, | ||
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "6.2.0" : undefined, | ||
}, | ||
@@ -131,3 +146,3 @@ application: { | ||
} | ||
lifeCycle.notify(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent); | ||
lifeCycle.notify(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent); | ||
} | ||
@@ -134,0 +149,0 @@ } |
@@ -1,14 +0,4 @@ | ||
import type { DefaultPrivacyLevel } from '@datadog/browser-core'; | ||
import type { RumInitConfiguration } from './configuration'; | ||
export declare const REMOTE_CONFIGURATION_URL = "https://d3uc069fcn7uxw.cloudfront.net/configuration"; | ||
export interface RumRemoteConfiguration { | ||
sessionSampleRate?: number; | ||
sessionReplaySampleRate?: number; | ||
defaultPrivacyLevel?: DefaultPrivacyLevel; | ||
} | ||
export declare function fetchAndApplyRemoteConfiguration(initConfiguration: RumInitConfiguration, callback: (initConfiguration: RumInitConfiguration) => void): void; | ||
export declare function applyRemoteConfiguration(initConfiguration: RumInitConfiguration, remoteInitConfiguration: RumRemoteConfiguration): { | ||
sessionSampleRate?: number | undefined; | ||
sessionReplaySampleRate?: number | undefined; | ||
defaultPrivacyLevel?: DefaultPrivacyLevel | undefined; | ||
export declare function applyRemoteConfiguration(initConfiguration: RumInitConfiguration, remoteInitConfiguration: Partial<RumInitConfiguration>): { | ||
applicationId: string; | ||
@@ -23,3 +13,5 @@ beforeSend?: ((event: import("../..").RumEvent, context: import("../..").RumEventDomainContext) => boolean) | undefined; | ||
traceContextInjection?: import("@datadog/browser-core").TraceContextInjection | undefined; | ||
defaultPrivacyLevel?: import("@datadog/browser-core").DefaultPrivacyLevel | undefined; | ||
subdomain?: string; | ||
sessionReplaySampleRate?: number | undefined; | ||
startSessionReplayRecordingManually?: boolean | undefined; | ||
@@ -35,2 +27,3 @@ enablePrivacyForActionName?: boolean | undefined; | ||
clientToken: string; | ||
sessionSampleRate?: number | undefined; | ||
telemetrySampleRate?: number | undefined; | ||
@@ -62,2 +55,3 @@ silentMultipleInit?: boolean | undefined; | ||
}; | ||
export declare function fetchRemoteConfiguration(configuration: RumInitConfiguration, callback: (remoteConfiguration: RumRemoteConfiguration) => void): void; | ||
export declare function fetchRemoteConfiguration(configuration: RumInitConfiguration, callback: (remoteConfiguration: Partial<RumInitConfiguration>) => void): void; | ||
export declare function buildEndpoint(configuration: RumInitConfiguration): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.REMOTE_CONFIGURATION_URL = void 0; | ||
exports.fetchAndApplyRemoteConfiguration = fetchAndApplyRemoteConfiguration; | ||
exports.applyRemoteConfiguration = applyRemoteConfiguration; | ||
exports.fetchRemoteConfiguration = fetchRemoteConfiguration; | ||
exports.buildEndpoint = buildEndpoint; | ||
const browser_core_1 = require("@datadog/browser-core"); | ||
exports.REMOTE_CONFIGURATION_URL = 'https://d3uc069fcn7uxw.cloudfront.net/configuration'; | ||
const REMOTE_CONFIGURATION_VERSION = 'v1'; | ||
function fetchAndApplyRemoteConfiguration(initConfiguration, callback) { | ||
@@ -21,3 +21,4 @@ fetchRemoteConfiguration(initConfiguration, (remoteInitConfiguration) => { | ||
if (xhr.status === 200) { | ||
callback(JSON.parse(xhr.responseText)); | ||
const remoteConfiguration = JSON.parse(xhr.responseText); | ||
callback(remoteConfiguration.rum); | ||
} | ||
@@ -31,5 +32,8 @@ else { | ||
}); | ||
xhr.open('GET', `${exports.REMOTE_CONFIGURATION_URL}/${encodeURIComponent(configuration.remoteConfigurationId)}.json`); | ||
xhr.open('GET', buildEndpoint(configuration)); | ||
xhr.send(); | ||
} | ||
function buildEndpoint(configuration) { | ||
return `https://sdk-configuration.${(0, browser_core_1.buildEndpointHost)('rum', configuration)}/${REMOTE_CONFIGURATION_VERSION}/${encodeURIComponent(configuration.remoteConfigurationId)}.json`; | ||
} | ||
function displayRemoteConfigurationFetchingError() { | ||
@@ -36,0 +40,0 @@ browser_core_1.display.error('Error fetching the remote configuration.'); |
@@ -24,3 +24,3 @@ "use strict"; | ||
}); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
featureFlagContexts.closeActive(endClocks.relative); | ||
@@ -27,0 +27,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import type { RelativeTime, Observable } from '@datadog/browser-core'; | ||
import type { RelativeTime, Observable, Context } from '@datadog/browser-core'; | ||
import type { LocationChange } from '../../browser/locationChangeObservable'; | ||
@@ -16,2 +16,4 @@ import type { LifeCycle } from '../lifeCycle'; | ||
findUrl: (startTime?: RelativeTime) => UrlContext | undefined; | ||
getAllEntries: () => Context[]; | ||
getDeletedEntries: () => RelativeTime[]; | ||
stop: () => void; | ||
@@ -21,3 +23,5 @@ } | ||
findUrl: (startTime?: RelativeTime) => UrlContext | undefined; | ||
getAllEntries: () => Context[]; | ||
getDeletedEntries: () => RelativeTime[]; | ||
stop: () => void; | ||
}; |
@@ -23,3 +23,3 @@ "use strict"; | ||
}); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
urlContextHistory.closeActive(endClocks.relative); | ||
@@ -46,2 +46,4 @@ }); | ||
findUrl: (startTime) => urlContextHistory.find(startTime), | ||
getAllEntries: () => urlContextHistory.getAllEntries(), | ||
getDeletedEntries: () => urlContextHistory.getDeletedEntries(), | ||
stop: () => { | ||
@@ -48,0 +50,0 @@ locationChangeSubscription.unsubscribe(); |
@@ -15,3 +15,5 @@ import type { RelativeTime, ClocksState, Context } from '@datadog/browser-core'; | ||
stop: () => void; | ||
getAllEntries: () => Context[]; | ||
getDeletedEntries: () => RelativeTime[]; | ||
} | ||
export declare function startViewHistory(lifeCycle: LifeCycle): ViewHistory; |
@@ -12,6 +12,6 @@ "use strict"; | ||
}); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
viewValueHistory.closeActive(endClocks.relative); | ||
}); | ||
lifeCycle.subscribe(3 /* LifeCycleEventType.VIEW_UPDATED */, (viewUpdate) => { | ||
lifeCycle.subscribe(3 /* LifeCycleEventType.BEFORE_VIEW_UPDATED */, (viewUpdate) => { | ||
const currentView = viewValueHistory.find(viewUpdate.startClocks.relative); | ||
@@ -25,3 +25,3 @@ if (currentView && viewUpdate.name) { | ||
}); | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
viewValueHistory.reset(); | ||
@@ -41,2 +41,4 @@ }); | ||
findView: (startTime) => viewValueHistory.find(startTime), | ||
getAllEntries: () => viewValueHistory.getAllEntries(), | ||
getDeletedEntries: () => viewValueHistory.getDeletedEntries(), | ||
stop: () => { | ||
@@ -43,0 +45,0 @@ viewValueHistory.stop(); |
@@ -13,8 +13,8 @@ "use strict"; | ||
(0, trackReportError_1.trackReportError)(configuration, errorObservable); | ||
errorObservable.subscribe((error) => lifeCycle.notify(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error })); | ||
errorObservable.subscribe((error) => lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error })); | ||
return doStartErrorCollection(lifeCycle, pageStateHistory); | ||
} | ||
function doStartErrorCollection(lifeCycle, pageStateHistory) { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, ({ error, customerContext, savedCommonContext }) => { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.subscribe(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, ({ error, customerContext, savedCommonContext }) => { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
customerContext, | ||
@@ -38,3 +38,3 @@ savedCommonContext, | ||
}); | ||
lifeCycle.notify(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { | ||
lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { | ||
customerContext, | ||
@@ -41,0 +41,0 @@ savedCommonContext, |
@@ -9,3 +9,3 @@ import type { Context, PageExitEvent, RawError, RelativeTime } from '@datadog/browser-core'; | ||
import type { AutoAction } from './action/actionCollection'; | ||
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './view/trackViews'; | ||
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent, BeforeViewUpdateEvent } from './view/trackViews'; | ||
export declare const enum LifeCycleEventType { | ||
@@ -15,13 +15,14 @@ AUTO_ACTION_COMPLETED = 0, | ||
VIEW_CREATED = 2, | ||
VIEW_UPDATED = 3, | ||
VIEW_ENDED = 4, | ||
AFTER_VIEW_ENDED = 5, | ||
REQUEST_STARTED = 6, | ||
REQUEST_COMPLETED = 7, | ||
SESSION_EXPIRED = 8, | ||
SESSION_RENEWED = 9, | ||
PAGE_EXITED = 10, | ||
RAW_RUM_EVENT_COLLECTED = 11, | ||
RUM_EVENT_COLLECTED = 12, | ||
RAW_ERROR_COLLECTED = 13 | ||
BEFORE_VIEW_UPDATED = 3, | ||
VIEW_UPDATED = 4, | ||
VIEW_ENDED = 5, | ||
AFTER_VIEW_ENDED = 6, | ||
REQUEST_STARTED = 7, | ||
REQUEST_COMPLETED = 8, | ||
SESSION_EXPIRED = 9, | ||
SESSION_RENEWED = 10, | ||
PAGE_EXITED = 11, | ||
RAW_RUM_EVENT_COLLECTED = 12, | ||
RUM_EVENT_COLLECTED = 13, | ||
RAW_ERROR_COLLECTED = 14 | ||
} | ||
@@ -32,2 +33,3 @@ declare const LifeCycleEventTypeAsConst: { | ||
VIEW_CREATED: LifeCycleEventType.VIEW_CREATED; | ||
BEFORE_VIEW_UPDATED: LifeCycleEventType.BEFORE_VIEW_UPDATED; | ||
VIEW_UPDATED: LifeCycleEventType.VIEW_UPDATED; | ||
@@ -49,2 +51,3 @@ VIEW_ENDED: LifeCycleEventType.VIEW_ENDED; | ||
[LifeCycleEventTypeAsConst.VIEW_CREATED]: ViewCreatedEvent; | ||
[LifeCycleEventTypeAsConst.BEFORE_VIEW_UPDATED]: BeforeViewUpdateEvent; | ||
[LifeCycleEventTypeAsConst.VIEW_UPDATED]: ViewEvent; | ||
@@ -51,0 +54,0 @@ [LifeCycleEventTypeAsConst.VIEW_ENDED]: ViewEndedEvent; |
@@ -43,3 +43,3 @@ "use strict"; | ||
}; | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
rawRumEvent, | ||
@@ -46,0 +46,0 @@ startTime: startClocks.relative, |
@@ -31,3 +31,3 @@ "use strict"; | ||
}; | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
rawRumEvent, | ||
@@ -34,0 +34,0 @@ startTime: startClocks.relative, |
@@ -25,3 +25,3 @@ "use strict"; | ||
context.requestIndex = getNextRequestIndex(); | ||
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
requestIndex: context.requestIndex, | ||
@@ -33,3 +33,3 @@ url: context.url, | ||
tracer.clearTracingIfNeeded(context); | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
lifeCycle.notify(8 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
duration: context.duration, | ||
@@ -64,3 +64,3 @@ method: context.method, | ||
context.requestIndex = getNextRequestIndex(); | ||
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
requestIndex: context.requestIndex, | ||
@@ -73,3 +73,3 @@ url: context.url, | ||
tracer.clearTracingIfNeeded(context); | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
lifeCycle.notify(8 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
duration, | ||
@@ -76,0 +76,0 @@ method: context.method, |
@@ -11,3 +11,3 @@ "use strict"; | ||
function startResourceCollection(lifeCycle, configuration, pageStateHistory, taskQueue = (0, browser_core_1.createTaskQueue)(), retrieveInitialDocumentResourceTimingImpl = retrieveInitialDocumentResourceTiming_1.retrieveInitialDocumentResourceTiming) { | ||
lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
lifeCycle.subscribe(8 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
handleResource(() => processRequest(request, configuration, pageStateHistory)); | ||
@@ -32,3 +32,3 @@ }); | ||
if (rawEvent) { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, rawEvent); | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, rawEvent); | ||
} | ||
@@ -35,0 +35,0 @@ }); |
import type { RumPerformanceResourceTiming } from '../../browser/performanceObservable'; | ||
import type { RumConfiguration } from '../configuration'; | ||
export declare function retrieveInitialDocumentResourceTiming(configuration: RumConfiguration, callback: (timing: RumPerformanceResourceTiming) => void): void; | ||
import { getNavigationEntry } from '../../browser/performanceUtils'; | ||
export declare function retrieveInitialDocumentResourceTiming(configuration: RumConfiguration, callback: (timing: RumPerformanceResourceTiming) => void, getNavigationEntryImpl?: typeof getNavigationEntry): void; |
@@ -9,7 +9,11 @@ "use strict"; | ||
const resourceUtils_1 = require("./resourceUtils"); | ||
function retrieveInitialDocumentResourceTiming(configuration, callback) { | ||
function retrieveInitialDocumentResourceTiming(configuration, callback, getNavigationEntryImpl = performanceUtils_1.getNavigationEntry) { | ||
(0, browser_core_1.runOnReadyState)(configuration, 'interactive', () => { | ||
const entry = Object.assign((0, performanceUtils_1.getNavigationEntry)().toJSON(), { | ||
const navigationEntry = getNavigationEntryImpl(); | ||
const entry = Object.assign(navigationEntry.toJSON(), { | ||
entryType: performanceObservable_1.RumPerformanceEntryType.RESOURCE, | ||
initiatorType: resourceUtils_1.FAKE_INITIAL_DOCUMENT, | ||
// The ResourceTiming duration entry should be `responseEnd - startTime`. With | ||
// NavigationTiming entries, `startTime` is always 0, so set it to `responseEnd`. | ||
duration: navigationEntry.responseEnd, | ||
traceId: (0, getDocumentTraceId_1.getDocumentTraceId)(document), | ||
@@ -16,0 +20,0 @@ toJSON: () => ({ ...entry, toJSON: undefined }), |
@@ -11,6 +11,6 @@ "use strict"; | ||
sessionManager.expireObservable.subscribe(() => { | ||
lifeCycle.notify(8 /* LifeCycleEventType.SESSION_EXPIRED */); | ||
lifeCycle.notify(9 /* LifeCycleEventType.SESSION_EXPIRED */); | ||
}); | ||
sessionManager.renewObservable.subscribe(() => { | ||
lifeCycle.notify(9 /* LifeCycleEventType.SESSION_RENEWED */); | ||
lifeCycle.notify(10 /* LifeCycleEventType.SESSION_RENEWED */); | ||
}); | ||
@@ -17,0 +17,0 @@ sessionManager.sessionStateUpdateObservable.subscribe(({ previousState, newState }) => { |
@@ -19,3 +19,3 @@ "use strict"; | ||
// It means that contexts bytes count sums can be higher than it really is | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
batchHasRumEvent = true; | ||
@@ -22,0 +22,0 @@ updateMeasure(currentBatchMeasures.globalContextBytes, customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */).getBytesCount()); |
@@ -13,3 +13,3 @@ "use strict"; | ||
}; | ||
const subscription = lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
const subscription = lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
var _a; | ||
@@ -16,0 +16,0 @@ if (event.type === 'view' || event.type === 'vital' || !isChildEvent(event)) { |
@@ -37,2 +37,8 @@ import type { Duration, ClocksState, TimeStamp, RelativeTime, Context, ContextValue } from '@datadog/browser-core'; | ||
} | ||
export interface BeforeViewUpdateEvent { | ||
id: string; | ||
name?: string; | ||
context?: Context; | ||
startClocks: ClocksState; | ||
} | ||
export interface ViewEndedEvent { | ||
@@ -39,0 +45,0 @@ endClocks: ClocksState; |
@@ -35,3 +35,3 @@ "use strict"; | ||
function startViewLifeCycle() { | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
// Renew view on session renewal | ||
@@ -45,7 +45,7 @@ currentView = startNewView("route_change" /* ViewLoadingType.ROUTE_CHANGE */, undefined, { | ||
}); | ||
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_EXPIRED */, () => { | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_EXPIRED */, () => { | ||
currentView.end({ sessionIsActive: false }); | ||
}); | ||
// End the current view on page unload | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.PAGE_EXITED */, (pageExitEvent) => { | ||
lifeCycle.subscribe(11 /* LifeCycleEventType.PAGE_EXITED */, (pageExitEvent) => { | ||
if (pageExitEvent.reason === browser_core_1.PageExitReason.UNLOADING) { | ||
@@ -126,3 +126,3 @@ currentView.end(); | ||
// Update the view every time the measures are changing | ||
const { throttled: scheduleViewUpdate, cancel: cancelScheduleViewUpdate } = (0, browser_core_1.throttle)(triggerViewUpdate, exports.THROTTLE_VIEW_UPDATE_PERIOD, { | ||
const { throttled, cancel: cancelScheduleViewUpdate } = (0, browser_core_1.throttle)(triggerViewUpdate, exports.THROTTLE_VIEW_UPDATE_PERIOD, { | ||
leading: false, | ||
@@ -139,8 +139,22 @@ }); | ||
triggerViewUpdate(); | ||
contextManager.changeObservable.subscribe(triggerViewUpdate); | ||
// View context update should always be throttled | ||
contextManager.changeObservable.subscribe(scheduleViewUpdate); | ||
function triggerBeforeViewUpdate() { | ||
lifeCycle.notify(3 /* LifeCycleEventType.BEFORE_VIEW_UPDATED */, { | ||
id, | ||
name, | ||
context: contextManager.getContext(), | ||
startClocks, | ||
}); | ||
} | ||
function scheduleViewUpdate() { | ||
triggerBeforeViewUpdate(); | ||
throttled(); | ||
} | ||
function triggerViewUpdate() { | ||
cancelScheduleViewUpdate(); | ||
triggerBeforeViewUpdate(); | ||
documentVersion += 1; | ||
const currentEnd = endClocks === undefined ? (0, browser_core_1.timeStampNow)() : endClocks.timeStamp; | ||
lifeCycle.notify(3 /* LifeCycleEventType.VIEW_UPDATED */, { | ||
lifeCycle.notify(4 /* LifeCycleEventType.VIEW_UPDATED */, { | ||
customTimings, | ||
@@ -180,4 +194,4 @@ documentVersion, | ||
sessionIsActive = (_b = options.sessionIsActive) !== null && _b !== void 0 ? _b : true; | ||
lifeCycle.notify(4 /* LifeCycleEventType.VIEW_ENDED */, { endClocks }); | ||
lifeCycle.notify(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, { endClocks }); | ||
lifeCycle.notify(5 /* LifeCycleEventType.VIEW_ENDED */, { endClocks }); | ||
lifeCycle.notify(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, { endClocks }); | ||
(0, browser_core_1.clearInterval)(keepAliveIntervalId); | ||
@@ -184,0 +198,0 @@ setViewEnd(endClocks.relative); |
@@ -8,3 +8,3 @@ "use strict"; | ||
function startViewCollection(lifeCycle, configuration, location, domMutationObservable, pageOpenObserable, locationChangeObservable, pageStateHistory, recorderApi, initialViewOptions) { | ||
lifeCycle.subscribe(3 /* LifeCycleEventType.VIEW_UPDATED */, (view) => lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, configuration, recorderApi, pageStateHistory))); | ||
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_UPDATED */, (view) => lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, configuration, recorderApi, pageStateHistory))); | ||
return (0, trackViews_1.trackViews)(location, lifeCycle, domMutationObservable, pageOpenObserable, configuration, locationChangeObservable, !configuration.trackViewsManually, initialViewOptions); | ||
@@ -119,2 +119,3 @@ } | ||
target_selector: largestContentfulPaint.targetSelector, | ||
resource_url: largestContentfulPaint.resourceUrl, | ||
}, | ||
@@ -121,0 +122,0 @@ }; |
@@ -8,2 +8,3 @@ import type { RelativeTime } from '@datadog/browser-core'; | ||
targetSelector?: string; | ||
resourceUrl?: string; | ||
} | ||
@@ -10,0 +11,0 @@ /** |
@@ -45,2 +45,3 @@ "use strict"; | ||
targetSelector: lcpTargetSelector, | ||
resourceUrl: lcpEntry.url, | ||
}); | ||
@@ -47,0 +48,0 @@ biggestLcpSize = lcpEntry.size; |
@@ -19,3 +19,3 @@ "use strict"; | ||
if (isValid(vital)) { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processVital(vital, true)); | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processVital(vital, true)); | ||
} | ||
@@ -22,0 +22,0 @@ } |
@@ -87,3 +87,3 @@ "use strict"; | ||
} | ||
}), lifeCycle.subscribe(6 /* LifeCycleEventType.REQUEST_STARTED */, (startEvent) => { | ||
}), lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_STARTED */, (startEvent) => { | ||
if (isExcludedUrl(configuration, startEvent.url)) { | ||
@@ -97,3 +97,3 @@ return; | ||
notifyPageActivity(); | ||
}), lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
}), lifeCycle.subscribe(8 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
if (isExcludedUrl(configuration, request.url) || | ||
@@ -100,0 +100,0 @@ firstRequestIndex === undefined || |
@@ -1,15 +0,20 @@ | ||
export { RumPublicApi, makeRumPublicApi, RecorderApi, StartRecordingOptions, Strategy } from './boot/rumPublicApi'; | ||
export { StartRum } from './boot/startRum'; | ||
export { RumEvent, RumActionEvent, CommonProperties, RumErrorEvent, RumViewEvent, RumResourceEvent, RumLongTaskEvent, RumVitalEvent, } from './rumEvent.types'; | ||
export { RumLongTaskEventDomainContext, RumErrorEventDomainContext, RumOtherResourceEventDomainContext, RumXhrResourceEventDomainContext, RumFetchResourceEventDomainContext, RumActionEventDomainContext, RumViewEventDomainContext, RumEventDomainContext, } from './domainContext.types'; | ||
export { ReplayStats, ActionType, RumEventType, FrustrationType, RawRumActionEvent } from './rawRumEvent.types'; | ||
export type { RumPublicApi, RecorderApi, StartRecordingOptions, Strategy } from './boot/rumPublicApi'; | ||
export { makeRumPublicApi } from './boot/rumPublicApi'; | ||
export type { StartRum } from './boot/startRum'; | ||
export type { RumEvent, RumActionEvent, CommonProperties, RumErrorEvent, RumViewEvent, RumResourceEvent, RumLongTaskEvent, RumVitalEvent, } from './rumEvent.types'; | ||
export type { RumLongTaskEventDomainContext, RumErrorEventDomainContext, RumOtherResourceEventDomainContext, RumXhrResourceEventDomainContext, RumFetchResourceEventDomainContext, RumActionEventDomainContext, RumViewEventDomainContext, RumEventDomainContext, } from './domainContext.types'; | ||
export type { ReplayStats, RawRumActionEvent } from './rawRumEvent.types'; | ||
export { ActionType, RumEventType, FrustrationType } from './rawRumEvent.types'; | ||
export { startRum } from './boot/startRum'; | ||
export { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from './domain/lifeCycle'; | ||
export { ViewCreatedEvent } from './domain/view/trackViews'; | ||
export { ViewHistoryEntry, ViewHistory, startViewHistory } from './domain/contexts/viewHistory'; | ||
export { RumSessionManager, RumSession } from './domain/rumSessionManager'; | ||
export type { RawRumEventCollectedData } from './domain/lifeCycle'; | ||
export { LifeCycle, LifeCycleEventType } from './domain/lifeCycle'; | ||
export type { ViewCreatedEvent } from './domain/view/trackViews'; | ||
export type { ViewHistoryEntry, ViewHistory } from './domain/contexts/viewHistory'; | ||
export { startViewHistory } from './domain/contexts/viewHistory'; | ||
export type { RumSessionManager, RumSession } from './domain/rumSessionManager'; | ||
export { getMutationObserverConstructor } from './browser/domMutationObservable'; | ||
export { initViewportObservable, getViewportDimension, ViewportDimension } from './browser/viewportObservable'; | ||
export type { ViewportDimension } from './browser/viewportObservable'; | ||
export { initViewportObservable, getViewportDimension } from './browser/viewportObservable'; | ||
export { getScrollX, getScrollY } from './browser/scroll'; | ||
export { RumInitConfiguration, RumConfiguration, RumRemoteConfiguration } from './domain/configuration'; | ||
export type { RumInitConfiguration, RumConfiguration } from './domain/configuration'; | ||
export { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './domain/action/getActionNameFromElement'; | ||
@@ -16,0 +21,0 @@ export { STABLE_ATTRIBUTES } from './domain/getSelectorFromElement'; |
@@ -158,2 +158,3 @@ import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, RawErrorCause, DefaultPrivacyLevel, Connectivity, Csp } from '@datadog/browser-core'; | ||
target_selector?: string; | ||
resource_url?: string; | ||
}; | ||
@@ -160,0 +161,0 @@ } |
@@ -1596,2 +1596,6 @@ /** | ||
readonly target_selector?: string; | ||
/** | ||
* URL of the largest contentful paint element | ||
*/ | ||
readonly resource_url?: string; | ||
[k: string]: unknown; | ||
@@ -1598,0 +1602,0 @@ }; |
@@ -15,3 +15,3 @@ "use strict"; | ||
}, reportError, pageExitObservable, sessionExpireObservable); | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
if (serverRumEvent.type === "view" /* RumEventType.VIEW */) { | ||
@@ -18,0 +18,0 @@ batch.upsert(serverRumEvent, serverRumEvent.view.id); |
@@ -7,3 +7,3 @@ "use strict"; | ||
const bridge = (0, browser_core_1.getEventBridge)(); | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
bridge.send('rum', serverRumEvent); | ||
@@ -10,0 +10,0 @@ }); |
@@ -48,10 +48,16 @@ import { addTelemetryUsage, createContextManager, deepClone, makePublicApi, monitor, clocksNow, callMonitored, createHandlingStack, checkUser, sanitizeUser, sanitize, createIdentityEncoder, createCustomerDataTrackerManager, storeContextManager, displayAlreadyInitializedError, createTrackingConsentState, timeStampToClocks, } from '@datadog/browser-core'; | ||
strategy.setViewName(name); | ||
addTelemetryUsage({ feature: 'set-view-name' }); | ||
}), | ||
setViewContext: monitor((context) => { | ||
strategy.setViewContext(context); | ||
addTelemetryUsage({ feature: 'set-view-context' }); | ||
}), | ||
setViewContextProperty: monitor((key, value) => { | ||
strategy.setViewContextProperty(key, value); | ||
addTelemetryUsage({ feature: 'set-view-context-property' }); | ||
}), | ||
getViewContext: monitor(() => strategy.getViewContext()), | ||
getViewContext: monitor(() => { | ||
addTelemetryUsage({ feature: 'set-view-context-property' }); | ||
return strategy.getViewContext(); | ||
}), | ||
setGlobalContext: monitor((context) => { | ||
@@ -58,0 +64,0 @@ globalContextManager.setContext(context); |
@@ -39,2 +39,4 @@ import type { Observable, RawError, DeflateEncoderStreamId, Encoder, CustomerDataTrackerManager, TrackingConsentState } from '@datadog/browser-core'; | ||
findUrl: (startTime?: import("@datadog/browser-core").RelativeTime) => import("../domain/contexts/urlContexts").UrlContext | undefined; | ||
getAllEntries: () => import("@datadog/browser-core").Context[]; | ||
getDeletedEntries: () => import("@datadog/browser-core").RelativeTime[]; | ||
stop: () => void; | ||
@@ -41,0 +43,0 @@ }; |
@@ -35,3 +35,3 @@ import { sendToExtension, createPageExitObservable, startTelemetry, canUseEventBridge, getEventBridge, addTelemetryDebug, drainPreStartTelemetry, } from '@datadog/browser-core'; | ||
const lifeCycle = new LifeCycle(); | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => sendToExtension('rum', event)); | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => sendToExtension('rum', event)); | ||
const telemetry = startRumTelemetry(configuration); | ||
@@ -56,3 +56,3 @@ telemetry.setContextProvider(() => { | ||
const reportError = (error) => { | ||
lifeCycle.notify(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error }); | ||
lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error }); | ||
addTelemetryDebug('Error reported to customer', { 'error.message': error.message }); | ||
@@ -63,3 +63,3 @@ }; | ||
const pageExitSubscription = pageExitObservable.subscribe((event) => { | ||
lifeCycle.notify(10 /* LifeCycleEventType.PAGE_EXITED */, event); | ||
lifeCycle.notify(11 /* LifeCycleEventType.PAGE_EXITED */, event); | ||
}); | ||
@@ -66,0 +66,0 @@ cleanupTasks.push(() => pageExitSubscription.unsubscribe()); |
@@ -66,2 +66,3 @@ import type { Duration, RelativeTime } from '@datadog/browser-core'; | ||
startTime: RelativeTime; | ||
toJSON(): Omit<RumPerformancePaintTiming, 'toJSON'>; | ||
} | ||
@@ -83,2 +84,3 @@ export interface RumPerformanceNavigationTiming extends Omit<RumPerformanceResourceTiming, 'entryType'> { | ||
element?: Element; | ||
url?: string; | ||
toJSON(): Omit<RumLargestContentfulPaintTiming, 'toJSON'>; | ||
@@ -94,3 +96,3 @@ } | ||
interactionId?: number; | ||
name: string; | ||
toJSON(): Omit<RumFirstInputTiming, 'toJSON'>; | ||
} | ||
@@ -106,2 +108,3 @@ export interface RumPerformanceEventTiming { | ||
name: string; | ||
toJSON(): Omit<RumPerformanceEventTiming, 'toJSON'>; | ||
} | ||
@@ -119,2 +122,3 @@ export interface RumLayoutShiftAttribution { | ||
sources: RumLayoutShiftAttribution[]; | ||
toJSON(): Omit<RumLayoutShiftTiming, 'toJSON'>; | ||
} | ||
@@ -147,2 +151,3 @@ export type RumPerformanceScriptTiming = { | ||
styleAndLayoutStart: RelativeTime; | ||
toJSON(): Omit<RumPerformanceLongAnimationFrameTiming, 'toJSON'>; | ||
} | ||
@@ -149,0 +154,0 @@ export type RumPerformanceEntry = RumPerformanceResourceTiming | RumPerformanceLongTaskTiming | RumPerformanceLongAnimationFrameTiming | RumPerformancePaintTiming | RumPerformanceNavigationTiming | RumLargestContentfulPaintTiming | RumFirstInputTiming | RumPerformanceEventTiming | RumLayoutShiftTiming; |
@@ -16,3 +16,3 @@ import { getRelativeTime, isNumber } from '@datadog/browser-core'; | ||
startTime: 0, | ||
duration: timings.responseEnd, | ||
duration: timings.loadEventEnd, | ||
decodedBodySize: 0, | ||
@@ -19,0 +19,0 @@ encodedBodySize: 0, |
@@ -5,3 +5,3 @@ import { noop, combine, toServerDuration, generateUUID, ExperimentalFeature, isExperimentalFeatureEnabled, } from '@datadog/browser-core'; | ||
export function startActionCollection(lifeCycle, domMutationObservable, windowOpenObservable, configuration, pageStateHistory) { | ||
lifeCycle.subscribe(0 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, (action) => lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processAction(action, pageStateHistory))); | ||
lifeCycle.subscribe(0 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, (action) => lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processAction(action, pageStateHistory))); | ||
let actionContexts = { findActionId: noop }; | ||
@@ -15,3 +15,3 @@ let stop = noop; | ||
addAction: (action, savedCommonContext) => { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
savedCommonContext, | ||
@@ -18,0 +18,0 @@ ...processAction(action, pageStateHistory), |
@@ -16,6 +16,6 @@ import { timeStampNow, Observable, getRelativeTime, ONE_MINUTE, generateUUID, clocksNow, elapsed, createValueHistory, } from '@datadog/browser-core'; | ||
let currentClickChain; | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
history.reset(); | ||
}); | ||
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, stopClickChain); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.VIEW_ENDED */, stopClickChain); | ||
const { stop: stopActionEventsListener } = listenActionEvents(configuration, { | ||
@@ -97,3 +97,3 @@ onPointerDown: (pointerDownEvent) => processPointerDown(configuration, lifeCycle, domMutationObservable, pointerDownEvent, windowOpenObservable), | ||
}, CLICK_ACTION_MAX_DURATION); | ||
const viewEndedSubscription = lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, ({ endClocks }) => { | ||
const viewEndedSubscription = lifeCycle.subscribe(5 /* LifeCycleEventType.VIEW_ENDED */, ({ endClocks }) => { | ||
click.stop(endClocks.timeStamp); | ||
@@ -100,0 +100,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import { combine, isEmptyObject, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, round, isExperimentalFeatureEnabled, ExperimentalFeature, getConnectivity, } from '@datadog/browser-core'; | ||
import { combine, isEmptyObject, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, round, isExperimentalFeatureEnabled, ExperimentalFeature, getConnectivity, addTelemetryDebug, } from '@datadog/browser-core'; | ||
import { getSyntheticsContext } from './contexts/syntheticsContext'; | ||
@@ -59,6 +59,21 @@ import { limitModification } from './limitModification'; | ||
const syntheticsContext = getSyntheticsContext(); | ||
lifeCycle.subscribe(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, ({ startTime, rawRumEvent, domainContext, savedCommonContext, customerContext }) => { | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, ({ startTime, rawRumEvent, domainContext, savedCommonContext, customerContext }) => { | ||
const viewHistoryEntry = viewHistory.findView(startTime); | ||
const urlContext = urlContexts.findUrl(startTime); | ||
const session = sessionManager.findTrackedSession(startTime); | ||
if (session && | ||
viewHistoryEntry && | ||
!urlContext && | ||
isExperimentalFeatureEnabled(ExperimentalFeature.MISSING_URL_CONTEXT_TELEMETRY)) { | ||
addTelemetryDebug('Missing URL entry', { | ||
debug: { | ||
eventType: rawRumEvent.type, | ||
startTime, | ||
urlEntries: urlContexts.getAllEntries(), | ||
urlDeletedEntries: urlContexts.getDeletedEntries(), | ||
viewEntries: viewHistory.getAllEntries(), | ||
viewDeletedEntries: viewHistory.getDeletedEntries(), | ||
}, | ||
}); | ||
} | ||
if (session && viewHistoryEntry && urlContext) { | ||
@@ -75,3 +90,3 @@ const commonContext = savedCommonContext || getCommonContext(); | ||
}, | ||
browser_sdk_version: canUseEventBridge() ? "6.1.0" : undefined, | ||
browser_sdk_version: canUseEventBridge() ? "6.2.0" : undefined, | ||
}, | ||
@@ -128,3 +143,3 @@ application: { | ||
} | ||
lifeCycle.notify(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent); | ||
lifeCycle.notify(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent); | ||
} | ||
@@ -131,0 +146,0 @@ } |
@@ -1,14 +0,4 @@ | ||
import type { DefaultPrivacyLevel } from '@datadog/browser-core'; | ||
import type { RumInitConfiguration } from './configuration'; | ||
export declare const REMOTE_CONFIGURATION_URL = "https://d3uc069fcn7uxw.cloudfront.net/configuration"; | ||
export interface RumRemoteConfiguration { | ||
sessionSampleRate?: number; | ||
sessionReplaySampleRate?: number; | ||
defaultPrivacyLevel?: DefaultPrivacyLevel; | ||
} | ||
export declare function fetchAndApplyRemoteConfiguration(initConfiguration: RumInitConfiguration, callback: (initConfiguration: RumInitConfiguration) => void): void; | ||
export declare function applyRemoteConfiguration(initConfiguration: RumInitConfiguration, remoteInitConfiguration: RumRemoteConfiguration): { | ||
sessionSampleRate?: number | undefined; | ||
sessionReplaySampleRate?: number | undefined; | ||
defaultPrivacyLevel?: DefaultPrivacyLevel | undefined; | ||
export declare function applyRemoteConfiguration(initConfiguration: RumInitConfiguration, remoteInitConfiguration: Partial<RumInitConfiguration>): { | ||
applicationId: string; | ||
@@ -23,3 +13,5 @@ beforeSend?: ((event: import("../..").RumEvent, context: import("../..").RumEventDomainContext) => boolean) | undefined; | ||
traceContextInjection?: import("@datadog/browser-core").TraceContextInjection | undefined; | ||
defaultPrivacyLevel?: import("@datadog/browser-core").DefaultPrivacyLevel | undefined; | ||
subdomain?: string; | ||
sessionReplaySampleRate?: number | undefined; | ||
startSessionReplayRecordingManually?: boolean | undefined; | ||
@@ -35,2 +27,3 @@ enablePrivacyForActionName?: boolean | undefined; | ||
clientToken: string; | ||
sessionSampleRate?: number | undefined; | ||
telemetrySampleRate?: number | undefined; | ||
@@ -62,2 +55,3 @@ silentMultipleInit?: boolean | undefined; | ||
}; | ||
export declare function fetchRemoteConfiguration(configuration: RumInitConfiguration, callback: (remoteConfiguration: RumRemoteConfiguration) => void): void; | ||
export declare function fetchRemoteConfiguration(configuration: RumInitConfiguration, callback: (remoteConfiguration: Partial<RumInitConfiguration>) => void): void; | ||
export declare function buildEndpoint(configuration: RumInitConfiguration): string; |
@@ -1,3 +0,3 @@ | ||
import { display, addEventListener } from '@datadog/browser-core'; | ||
export const REMOTE_CONFIGURATION_URL = 'https://d3uc069fcn7uxw.cloudfront.net/configuration'; | ||
import { display, addEventListener, buildEndpointHost } from '@datadog/browser-core'; | ||
const REMOTE_CONFIGURATION_VERSION = 'v1'; | ||
export function fetchAndApplyRemoteConfiguration(initConfiguration, callback) { | ||
@@ -15,3 +15,4 @@ fetchRemoteConfiguration(initConfiguration, (remoteInitConfiguration) => { | ||
if (xhr.status === 200) { | ||
callback(JSON.parse(xhr.responseText)); | ||
const remoteConfiguration = JSON.parse(xhr.responseText); | ||
callback(remoteConfiguration.rum); | ||
} | ||
@@ -25,5 +26,8 @@ else { | ||
}); | ||
xhr.open('GET', `${REMOTE_CONFIGURATION_URL}/${encodeURIComponent(configuration.remoteConfigurationId)}.json`); | ||
xhr.open('GET', buildEndpoint(configuration)); | ||
xhr.send(); | ||
} | ||
export function buildEndpoint(configuration) { | ||
return `https://sdk-configuration.${buildEndpointHost('rum', configuration)}/${REMOTE_CONFIGURATION_VERSION}/${encodeURIComponent(configuration.remoteConfigurationId)}.json`; | ||
} | ||
function displayRemoteConfigurationFetchingError() { | ||
@@ -30,0 +34,0 @@ display.error('Error fetching the remote configuration.'); |
@@ -20,3 +20,3 @@ import { SESSION_TIME_OUT_DELAY, createValueHistory } from '@datadog/browser-core'; | ||
}); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
featureFlagContexts.closeActive(endClocks.relative); | ||
@@ -23,0 +23,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import type { RelativeTime, Observable } from '@datadog/browser-core'; | ||
import type { RelativeTime, Observable, Context } from '@datadog/browser-core'; | ||
import type { LocationChange } from '../../browser/locationChangeObservable'; | ||
@@ -16,2 +16,4 @@ import type { LifeCycle } from '../lifeCycle'; | ||
findUrl: (startTime?: RelativeTime) => UrlContext | undefined; | ||
getAllEntries: () => Context[]; | ||
getDeletedEntries: () => RelativeTime[]; | ||
stop: () => void; | ||
@@ -21,3 +23,5 @@ } | ||
findUrl: (startTime?: RelativeTime) => UrlContext | undefined; | ||
getAllEntries: () => Context[]; | ||
getDeletedEntries: () => RelativeTime[]; | ||
stop: () => void; | ||
}; |
@@ -19,3 +19,3 @@ import { SESSION_TIME_OUT_DELAY, relativeNow, createValueHistory } from '@datadog/browser-core'; | ||
}); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
urlContextHistory.closeActive(endClocks.relative); | ||
@@ -42,2 +42,4 @@ }); | ||
findUrl: (startTime) => urlContextHistory.find(startTime), | ||
getAllEntries: () => urlContextHistory.getAllEntries(), | ||
getDeletedEntries: () => urlContextHistory.getDeletedEntries(), | ||
stop: () => { | ||
@@ -44,0 +46,0 @@ locationChangeSubscription.unsubscribe(); |
@@ -15,3 +15,5 @@ import type { RelativeTime, ClocksState, Context } from '@datadog/browser-core'; | ||
stop: () => void; | ||
getAllEntries: () => Context[]; | ||
getDeletedEntries: () => RelativeTime[]; | ||
} | ||
export declare function startViewHistory(lifeCycle: LifeCycle): ViewHistory; |
@@ -8,6 +8,6 @@ import { SESSION_TIME_OUT_DELAY, createValueHistory } from '@datadog/browser-core'; | ||
}); | ||
lifeCycle.subscribe(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, ({ endClocks }) => { | ||
viewValueHistory.closeActive(endClocks.relative); | ||
}); | ||
lifeCycle.subscribe(3 /* LifeCycleEventType.VIEW_UPDATED */, (viewUpdate) => { | ||
lifeCycle.subscribe(3 /* LifeCycleEventType.BEFORE_VIEW_UPDATED */, (viewUpdate) => { | ||
const currentView = viewValueHistory.find(viewUpdate.startClocks.relative); | ||
@@ -21,3 +21,3 @@ if (currentView && viewUpdate.name) { | ||
}); | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
viewValueHistory.reset(); | ||
@@ -37,2 +37,4 @@ }); | ||
findView: (startTime) => viewValueHistory.find(startTime), | ||
getAllEntries: () => viewValueHistory.getAllEntries(), | ||
getDeletedEntries: () => viewValueHistory.getDeletedEntries(), | ||
stop: () => { | ||
@@ -39,0 +41,0 @@ viewValueHistory.stop(); |
@@ -9,8 +9,8 @@ import { ErrorSource, generateUUID, computeRawError, computeStackTrace, Observable, trackRuntimeError, isError, } from '@datadog/browser-core'; | ||
trackReportError(configuration, errorObservable); | ||
errorObservable.subscribe((error) => lifeCycle.notify(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error })); | ||
errorObservable.subscribe((error) => lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error })); | ||
return doStartErrorCollection(lifeCycle, pageStateHistory); | ||
} | ||
export function doStartErrorCollection(lifeCycle, pageStateHistory) { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, ({ error, customerContext, savedCommonContext }) => { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.subscribe(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, ({ error, customerContext, savedCommonContext }) => { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
customerContext, | ||
@@ -34,3 +34,3 @@ savedCommonContext, | ||
}); | ||
lifeCycle.notify(13 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { | ||
lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { | ||
customerContext, | ||
@@ -37,0 +37,0 @@ savedCommonContext, |
@@ -9,3 +9,3 @@ import type { Context, PageExitEvent, RawError, RelativeTime } from '@datadog/browser-core'; | ||
import type { AutoAction } from './action/actionCollection'; | ||
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './view/trackViews'; | ||
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent, BeforeViewUpdateEvent } from './view/trackViews'; | ||
export declare const enum LifeCycleEventType { | ||
@@ -15,13 +15,14 @@ AUTO_ACTION_COMPLETED = 0, | ||
VIEW_CREATED = 2, | ||
VIEW_UPDATED = 3, | ||
VIEW_ENDED = 4, | ||
AFTER_VIEW_ENDED = 5, | ||
REQUEST_STARTED = 6, | ||
REQUEST_COMPLETED = 7, | ||
SESSION_EXPIRED = 8, | ||
SESSION_RENEWED = 9, | ||
PAGE_EXITED = 10, | ||
RAW_RUM_EVENT_COLLECTED = 11, | ||
RUM_EVENT_COLLECTED = 12, | ||
RAW_ERROR_COLLECTED = 13 | ||
BEFORE_VIEW_UPDATED = 3, | ||
VIEW_UPDATED = 4, | ||
VIEW_ENDED = 5, | ||
AFTER_VIEW_ENDED = 6, | ||
REQUEST_STARTED = 7, | ||
REQUEST_COMPLETED = 8, | ||
SESSION_EXPIRED = 9, | ||
SESSION_RENEWED = 10, | ||
PAGE_EXITED = 11, | ||
RAW_RUM_EVENT_COLLECTED = 12, | ||
RUM_EVENT_COLLECTED = 13, | ||
RAW_ERROR_COLLECTED = 14 | ||
} | ||
@@ -32,2 +33,3 @@ declare const LifeCycleEventTypeAsConst: { | ||
VIEW_CREATED: LifeCycleEventType.VIEW_CREATED; | ||
BEFORE_VIEW_UPDATED: LifeCycleEventType.BEFORE_VIEW_UPDATED; | ||
VIEW_UPDATED: LifeCycleEventType.VIEW_UPDATED; | ||
@@ -49,2 +51,3 @@ VIEW_ENDED: LifeCycleEventType.VIEW_ENDED; | ||
[LifeCycleEventTypeAsConst.VIEW_CREATED]: ViewCreatedEvent; | ||
[LifeCycleEventTypeAsConst.BEFORE_VIEW_UPDATED]: BeforeViewUpdateEvent; | ||
[LifeCycleEventTypeAsConst.VIEW_UPDATED]: ViewEvent; | ||
@@ -51,0 +54,0 @@ [LifeCycleEventTypeAsConst.VIEW_ENDED]: ViewEndedEvent; |
@@ -40,3 +40,3 @@ import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core'; | ||
}; | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
rawRumEvent, | ||
@@ -43,0 +43,0 @@ startTime: startClocks.relative, |
@@ -28,3 +28,3 @@ import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core'; | ||
}; | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, { | ||
rawRumEvent, | ||
@@ -31,0 +31,0 @@ startTime: startClocks.relative, |
@@ -20,3 +20,3 @@ import { initFetchObservable, initXhrObservable, readBytesFromStream, elapsed, timeStampNow, tryToClone, } from '@datadog/browser-core'; | ||
context.requestIndex = getNextRequestIndex(); | ||
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
requestIndex: context.requestIndex, | ||
@@ -28,3 +28,3 @@ url: context.url, | ||
tracer.clearTracingIfNeeded(context); | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
lifeCycle.notify(8 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
duration: context.duration, | ||
@@ -59,3 +59,3 @@ method: context.method, | ||
context.requestIndex = getNextRequestIndex(); | ||
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_STARTED */, { | ||
requestIndex: context.requestIndex, | ||
@@ -68,3 +68,3 @@ url: context.url, | ||
tracer.clearTracingIfNeeded(context); | ||
lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
lifeCycle.notify(8 /* LifeCycleEventType.REQUEST_COMPLETED */, { | ||
duration, | ||
@@ -71,0 +71,0 @@ method: context.method, |
@@ -8,3 +8,3 @@ import { combine, generateUUID, toServerDuration, relativeToClocks, createTaskQueue, } from '@datadog/browser-core'; | ||
export function startResourceCollection(lifeCycle, configuration, pageStateHistory, taskQueue = createTaskQueue(), retrieveInitialDocumentResourceTimingImpl = retrieveInitialDocumentResourceTiming) { | ||
lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
lifeCycle.subscribe(8 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
handleResource(() => processRequest(request, configuration, pageStateHistory)); | ||
@@ -29,3 +29,3 @@ }); | ||
if (rawEvent) { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, rawEvent); | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, rawEvent); | ||
} | ||
@@ -32,0 +32,0 @@ }); |
import type { RumPerformanceResourceTiming } from '../../browser/performanceObservable'; | ||
import type { RumConfiguration } from '../configuration'; | ||
export declare function retrieveInitialDocumentResourceTiming(configuration: RumConfiguration, callback: (timing: RumPerformanceResourceTiming) => void): void; | ||
import { getNavigationEntry } from '../../browser/performanceUtils'; | ||
export declare function retrieveInitialDocumentResourceTiming(configuration: RumConfiguration, callback: (timing: RumPerformanceResourceTiming) => void, getNavigationEntryImpl?: typeof getNavigationEntry): void; |
@@ -6,7 +6,11 @@ import { runOnReadyState } from '@datadog/browser-core'; | ||
import { FAKE_INITIAL_DOCUMENT } from './resourceUtils'; | ||
export function retrieveInitialDocumentResourceTiming(configuration, callback) { | ||
export function retrieveInitialDocumentResourceTiming(configuration, callback, getNavigationEntryImpl = getNavigationEntry) { | ||
runOnReadyState(configuration, 'interactive', () => { | ||
const entry = Object.assign(getNavigationEntry().toJSON(), { | ||
const navigationEntry = getNavigationEntryImpl(); | ||
const entry = Object.assign(navigationEntry.toJSON(), { | ||
entryType: RumPerformanceEntryType.RESOURCE, | ||
initiatorType: FAKE_INITIAL_DOCUMENT, | ||
// The ResourceTiming duration entry should be `responseEnd - startTime`. With | ||
// NavigationTiming entries, `startTime` is always 0, so set it to `responseEnd`. | ||
duration: navigationEntry.responseEnd, | ||
traceId: getDocumentTraceId(document), | ||
@@ -13,0 +17,0 @@ toJSON: () => ({ ...entry, toJSON: undefined }), |
@@ -6,6 +6,6 @@ import { Observable, bridgeSupports, noop, performDraw, startSessionManager, } from '@datadog/browser-core'; | ||
sessionManager.expireObservable.subscribe(() => { | ||
lifeCycle.notify(8 /* LifeCycleEventType.SESSION_EXPIRED */); | ||
lifeCycle.notify(9 /* LifeCycleEventType.SESSION_EXPIRED */); | ||
}); | ||
sessionManager.renewObservable.subscribe(() => { | ||
lifeCycle.notify(9 /* LifeCycleEventType.SESSION_RENEWED */); | ||
lifeCycle.notify(10 /* LifeCycleEventType.SESSION_RENEWED */); | ||
}); | ||
@@ -12,0 +12,0 @@ sessionManager.sessionStateUpdateObservable.subscribe(({ previousState, newState }) => { |
@@ -15,3 +15,3 @@ import { performDraw, ONE_SECOND, addTelemetryDebug, setInterval } from '@datadog/browser-core'; | ||
// It means that contexts bytes count sums can be higher than it really is | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
batchHasRumEvent = true; | ||
@@ -18,0 +18,0 @@ updateMeasure(currentBatchMeasures.globalContextBytes, customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */).getBytesCount()); |
@@ -10,3 +10,3 @@ import { noop } from '@datadog/browser-core'; | ||
}; | ||
const subscription = lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
const subscription = lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (event) => { | ||
var _a; | ||
@@ -13,0 +13,0 @@ if (event.type === 'view' || event.type === 'vital' || !isChildEvent(event)) { |
@@ -37,2 +37,8 @@ import type { Duration, ClocksState, TimeStamp, RelativeTime, Context, ContextValue } from '@datadog/browser-core'; | ||
} | ||
export interface BeforeViewUpdateEvent { | ||
id: string; | ||
name?: string; | ||
context?: Context; | ||
startClocks: ClocksState; | ||
} | ||
export interface ViewEndedEvent { | ||
@@ -39,0 +45,0 @@ endClocks: ClocksState; |
@@ -31,3 +31,3 @@ import { noop, PageExitReason, shallowClone, elapsed, generateUUID, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, display, looksLikeRelativeTime, setInterval, clearInterval, setTimeout, Observable, createContextManager, } from '@datadog/browser-core'; | ||
function startViewLifeCycle() { | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, () => { | ||
// Renew view on session renewal | ||
@@ -41,7 +41,7 @@ currentView = startNewView("route_change" /* ViewLoadingType.ROUTE_CHANGE */, undefined, { | ||
}); | ||
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_EXPIRED */, () => { | ||
lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_EXPIRED */, () => { | ||
currentView.end({ sessionIsActive: false }); | ||
}); | ||
// End the current view on page unload | ||
lifeCycle.subscribe(10 /* LifeCycleEventType.PAGE_EXITED */, (pageExitEvent) => { | ||
lifeCycle.subscribe(11 /* LifeCycleEventType.PAGE_EXITED */, (pageExitEvent) => { | ||
if (pageExitEvent.reason === PageExitReason.UNLOADING) { | ||
@@ -122,3 +122,3 @@ currentView.end(); | ||
// Update the view every time the measures are changing | ||
const { throttled: scheduleViewUpdate, cancel: cancelScheduleViewUpdate } = throttle(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, { | ||
const { throttled, cancel: cancelScheduleViewUpdate } = throttle(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, { | ||
leading: false, | ||
@@ -135,8 +135,22 @@ }); | ||
triggerViewUpdate(); | ||
contextManager.changeObservable.subscribe(triggerViewUpdate); | ||
// View context update should always be throttled | ||
contextManager.changeObservable.subscribe(scheduleViewUpdate); | ||
function triggerBeforeViewUpdate() { | ||
lifeCycle.notify(3 /* LifeCycleEventType.BEFORE_VIEW_UPDATED */, { | ||
id, | ||
name, | ||
context: contextManager.getContext(), | ||
startClocks, | ||
}); | ||
} | ||
function scheduleViewUpdate() { | ||
triggerBeforeViewUpdate(); | ||
throttled(); | ||
} | ||
function triggerViewUpdate() { | ||
cancelScheduleViewUpdate(); | ||
triggerBeforeViewUpdate(); | ||
documentVersion += 1; | ||
const currentEnd = endClocks === undefined ? timeStampNow() : endClocks.timeStamp; | ||
lifeCycle.notify(3 /* LifeCycleEventType.VIEW_UPDATED */, { | ||
lifeCycle.notify(4 /* LifeCycleEventType.VIEW_UPDATED */, { | ||
customTimings, | ||
@@ -176,4 +190,4 @@ documentVersion, | ||
sessionIsActive = (_b = options.sessionIsActive) !== null && _b !== void 0 ? _b : true; | ||
lifeCycle.notify(4 /* LifeCycleEventType.VIEW_ENDED */, { endClocks }); | ||
lifeCycle.notify(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, { endClocks }); | ||
lifeCycle.notify(5 /* LifeCycleEventType.VIEW_ENDED */, { endClocks }); | ||
lifeCycle.notify(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, { endClocks }); | ||
clearInterval(keepAliveIntervalId); | ||
@@ -180,0 +194,0 @@ setViewEnd(endClocks.relative); |
@@ -5,3 +5,3 @@ import { isEmptyObject, mapValues, toServerDuration } from '@datadog/browser-core'; | ||
export function startViewCollection(lifeCycle, configuration, location, domMutationObservable, pageOpenObserable, locationChangeObservable, pageStateHistory, recorderApi, initialViewOptions) { | ||
lifeCycle.subscribe(3 /* LifeCycleEventType.VIEW_UPDATED */, (view) => lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, configuration, recorderApi, pageStateHistory))); | ||
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_UPDATED */, (view) => lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, configuration, recorderApi, pageStateHistory))); | ||
return trackViews(location, lifeCycle, domMutationObservable, pageOpenObserable, configuration, locationChangeObservable, !configuration.trackViewsManually, initialViewOptions); | ||
@@ -116,2 +116,3 @@ } | ||
target_selector: largestContentfulPaint.targetSelector, | ||
resource_url: largestContentfulPaint.resourceUrl, | ||
}, | ||
@@ -118,0 +119,0 @@ }; |
@@ -8,2 +8,3 @@ import type { RelativeTime } from '@datadog/browser-core'; | ||
targetSelector?: string; | ||
resourceUrl?: string; | ||
} | ||
@@ -10,0 +11,0 @@ /** |
@@ -41,2 +41,3 @@ import { ONE_MINUTE, addEventListeners, findLast } from '@datadog/browser-core'; | ||
targetSelector: lcpTargetSelector, | ||
resourceUrl: lcpEntry.url, | ||
}); | ||
@@ -43,0 +44,0 @@ biggestLcpSize = lcpEntry.size; |
@@ -13,3 +13,3 @@ import { clocksNow, combine, elapsed, generateUUID, toServerDuration } from '@datadog/browser-core'; | ||
if (isValid(vital)) { | ||
lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processVital(vital, true)); | ||
lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processVital(vital, true)); | ||
} | ||
@@ -16,0 +16,0 @@ } |
@@ -81,3 +81,3 @@ import { matchList, monitor, Observable, timeStampNow, setTimeout, clearTimeout } from '@datadog/browser-core'; | ||
} | ||
}), lifeCycle.subscribe(6 /* LifeCycleEventType.REQUEST_STARTED */, (startEvent) => { | ||
}), lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_STARTED */, (startEvent) => { | ||
if (isExcludedUrl(configuration, startEvent.url)) { | ||
@@ -91,3 +91,3 @@ return; | ||
notifyPageActivity(); | ||
}), lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
}), lifeCycle.subscribe(8 /* LifeCycleEventType.REQUEST_COMPLETED */, (request) => { | ||
if (isExcludedUrl(configuration, request.url) || | ||
@@ -94,0 +94,0 @@ firstRequestIndex === undefined || |
@@ -1,15 +0,20 @@ | ||
export { RumPublicApi, makeRumPublicApi, RecorderApi, StartRecordingOptions, Strategy } from './boot/rumPublicApi'; | ||
export { StartRum } from './boot/startRum'; | ||
export { RumEvent, RumActionEvent, CommonProperties, RumErrorEvent, RumViewEvent, RumResourceEvent, RumLongTaskEvent, RumVitalEvent, } from './rumEvent.types'; | ||
export { RumLongTaskEventDomainContext, RumErrorEventDomainContext, RumOtherResourceEventDomainContext, RumXhrResourceEventDomainContext, RumFetchResourceEventDomainContext, RumActionEventDomainContext, RumViewEventDomainContext, RumEventDomainContext, } from './domainContext.types'; | ||
export { ReplayStats, ActionType, RumEventType, FrustrationType, RawRumActionEvent } from './rawRumEvent.types'; | ||
export type { RumPublicApi, RecorderApi, StartRecordingOptions, Strategy } from './boot/rumPublicApi'; | ||
export { makeRumPublicApi } from './boot/rumPublicApi'; | ||
export type { StartRum } from './boot/startRum'; | ||
export type { RumEvent, RumActionEvent, CommonProperties, RumErrorEvent, RumViewEvent, RumResourceEvent, RumLongTaskEvent, RumVitalEvent, } from './rumEvent.types'; | ||
export type { RumLongTaskEventDomainContext, RumErrorEventDomainContext, RumOtherResourceEventDomainContext, RumXhrResourceEventDomainContext, RumFetchResourceEventDomainContext, RumActionEventDomainContext, RumViewEventDomainContext, RumEventDomainContext, } from './domainContext.types'; | ||
export type { ReplayStats, RawRumActionEvent } from './rawRumEvent.types'; | ||
export { ActionType, RumEventType, FrustrationType } from './rawRumEvent.types'; | ||
export { startRum } from './boot/startRum'; | ||
export { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from './domain/lifeCycle'; | ||
export { ViewCreatedEvent } from './domain/view/trackViews'; | ||
export { ViewHistoryEntry, ViewHistory, startViewHistory } from './domain/contexts/viewHistory'; | ||
export { RumSessionManager, RumSession } from './domain/rumSessionManager'; | ||
export type { RawRumEventCollectedData } from './domain/lifeCycle'; | ||
export { LifeCycle, LifeCycleEventType } from './domain/lifeCycle'; | ||
export type { ViewCreatedEvent } from './domain/view/trackViews'; | ||
export type { ViewHistoryEntry, ViewHistory } from './domain/contexts/viewHistory'; | ||
export { startViewHistory } from './domain/contexts/viewHistory'; | ||
export type { RumSessionManager, RumSession } from './domain/rumSessionManager'; | ||
export { getMutationObserverConstructor } from './browser/domMutationObservable'; | ||
export { initViewportObservable, getViewportDimension, ViewportDimension } from './browser/viewportObservable'; | ||
export type { ViewportDimension } from './browser/viewportObservable'; | ||
export { initViewportObservable, getViewportDimension } from './browser/viewportObservable'; | ||
export { getScrollX, getScrollY } from './browser/scroll'; | ||
export { RumInitConfiguration, RumConfiguration, RumRemoteConfiguration } from './domain/configuration'; | ||
export type { RumInitConfiguration, RumConfiguration } from './domain/configuration'; | ||
export { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './domain/action/getActionNameFromElement'; | ||
@@ -16,0 +21,0 @@ export { STABLE_ATTRIBUTES } from './domain/getSelectorFromElement'; |
@@ -158,2 +158,3 @@ import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, RawErrorCause, DefaultPrivacyLevel, Connectivity, Csp } from '@datadog/browser-core'; | ||
target_selector?: string; | ||
resource_url?: string; | ||
}; | ||
@@ -160,0 +161,0 @@ } |
@@ -1596,2 +1596,6 @@ /** | ||
readonly target_selector?: string; | ||
/** | ||
* URL of the largest contentful paint element | ||
*/ | ||
readonly resource_url?: string; | ||
[k: string]: unknown; | ||
@@ -1598,0 +1602,0 @@ }; |
@@ -12,3 +12,3 @@ import { combine, isTelemetryReplicationAllowed, startBatchWithReplica, } from '@datadog/browser-core'; | ||
}, reportError, pageExitObservable, sessionExpireObservable); | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
if (serverRumEvent.type === "view" /* RumEventType.VIEW */) { | ||
@@ -15,0 +15,0 @@ batch.upsert(serverRumEvent, serverRumEvent.view.id); |
import { getEventBridge } from '@datadog/browser-core'; | ||
export function startRumEventBridge(lifeCycle) { | ||
const bridge = getEventBridge(); | ||
lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, (serverRumEvent) => { | ||
bridge.send('rum', serverRumEvent); | ||
@@ -6,0 +6,0 @@ }); |
{ | ||
"name": "@datadog/browser-rum-core", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"license": "Apache-2.0", | ||
@@ -15,3 +15,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@datadog/browser-core": "6.1.0" | ||
"@datadog/browser-core": "6.2.0" | ||
}, | ||
@@ -32,3 +32,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "74168bb4dc9c50561947e1899194ddb559fc7f3c" | ||
"gitHead": "a1a15c22c45a1a800851ab90a56956d5d567866d" | ||
} |
@@ -455,2 +455,3 @@ import type { | ||
strategy.setViewName(name) | ||
addTelemetryUsage({ feature: 'set-view-name' }) | ||
}), | ||
@@ -460,2 +461,3 @@ | ||
strategy.setViewContext(context) | ||
addTelemetryUsage({ feature: 'set-view-context' }) | ||
}), | ||
@@ -465,5 +467,9 @@ | ||
strategy.setViewContextProperty(key, value) | ||
addTelemetryUsage({ feature: 'set-view-context-property' }) | ||
}), | ||
getViewContext: monitor(() => strategy.getViewContext()), | ||
getViewContext: monitor(() => { | ||
addTelemetryUsage({ feature: 'set-view-context-property' }) | ||
return strategy.getViewContext() | ||
}), | ||
@@ -470,0 +476,0 @@ setGlobalContext: monitor((context) => { |
@@ -74,2 +74,3 @@ import type { Duration, RelativeTime, TimeoutId } from '@datadog/browser-core' | ||
startTime: RelativeTime | ||
toJSON(): Omit<RumPerformancePaintTiming, 'toJSON'> | ||
} | ||
@@ -95,2 +96,3 @@ | ||
element?: Element | ||
url?: string | ||
toJSON(): Omit<RumLargestContentfulPaintTiming, 'toJSON'> | ||
@@ -107,3 +109,3 @@ } | ||
interactionId?: number | ||
name: string | ||
toJSON(): Omit<RumFirstInputTiming, 'toJSON'> | ||
} | ||
@@ -120,2 +122,3 @@ | ||
name: string | ||
toJSON(): Omit<RumPerformanceEventTiming, 'toJSON'> | ||
} | ||
@@ -135,2 +138,3 @@ | ||
sources: RumLayoutShiftAttribution[] | ||
toJSON(): Omit<RumLayoutShiftTiming, 'toJSON'> | ||
} | ||
@@ -172,2 +176,3 @@ | ||
styleAndLayoutStart: RelativeTime | ||
toJSON(): Omit<RumPerformanceLongAnimationFrameTiming, 'toJSON'> | ||
} | ||
@@ -174,0 +179,0 @@ |
@@ -25,3 +25,3 @@ import type { RelativeTime, TimeStamp } from '@datadog/browser-core' | ||
startTime: 0 as RelativeTime, | ||
duration: timings.responseEnd, | ||
duration: timings.loadEventEnd, | ||
decodedBodySize: 0, | ||
@@ -28,0 +28,0 @@ encodedBodySize: 0, |
@@ -14,2 +14,3 @@ import type { Context, RawError, EventRateLimiter, User, RelativeTime } from '@datadog/browser-core' | ||
getConnectivity, | ||
addTelemetryDebug, | ||
} from '@datadog/browser-core' | ||
@@ -142,2 +143,21 @@ import type { RumEventDomainContext } from '../domainContext.types' | ||
const session = sessionManager.findTrackedSession(startTime) | ||
if ( | ||
session && | ||
viewHistoryEntry && | ||
!urlContext && | ||
isExperimentalFeatureEnabled(ExperimentalFeature.MISSING_URL_CONTEXT_TELEMETRY) | ||
) { | ||
addTelemetryDebug('Missing URL entry', { | ||
debug: { | ||
eventType: rawRumEvent.type, | ||
startTime, | ||
urlEntries: urlContexts.getAllEntries(), | ||
urlDeletedEntries: urlContexts.getDeletedEntries(), | ||
viewEntries: viewHistory.getAllEntries(), | ||
viewDeletedEntries: viewHistory.getDeletedEntries(), | ||
}, | ||
}) | ||
} | ||
if (session && viewHistoryEntry && urlContext) { | ||
@@ -144,0 +164,0 @@ const commonContext = savedCommonContext || getCommonContext() |
@@ -1,13 +0,6 @@ | ||
import type { DefaultPrivacyLevel } from '@datadog/browser-core' | ||
import { display, addEventListener } from '@datadog/browser-core' | ||
import { display, addEventListener, buildEndpointHost } from '@datadog/browser-core' | ||
import type { RumInitConfiguration } from './configuration' | ||
export const REMOTE_CONFIGURATION_URL = 'https://d3uc069fcn7uxw.cloudfront.net/configuration' | ||
const REMOTE_CONFIGURATION_VERSION = 'v1' | ||
export interface RumRemoteConfiguration { | ||
sessionSampleRate?: number | ||
sessionReplaySampleRate?: number | ||
defaultPrivacyLevel?: DefaultPrivacyLevel | ||
} | ||
export function fetchAndApplyRemoteConfiguration( | ||
@@ -24,3 +17,3 @@ initConfiguration: RumInitConfiguration, | ||
initConfiguration: RumInitConfiguration, | ||
remoteInitConfiguration: RumRemoteConfiguration | ||
remoteInitConfiguration: Partial<RumInitConfiguration> | ||
) { | ||
@@ -32,3 +25,3 @@ return { ...initConfiguration, ...remoteInitConfiguration } | ||
configuration: RumInitConfiguration, | ||
callback: (remoteConfiguration: RumRemoteConfiguration) => void | ||
callback: (remoteConfiguration: Partial<RumInitConfiguration>) => void | ||
) { | ||
@@ -39,3 +32,4 @@ const xhr = new XMLHttpRequest() | ||
if (xhr.status === 200) { | ||
callback(JSON.parse(xhr.responseText)) | ||
const remoteConfiguration = JSON.parse(xhr.responseText) | ||
callback(remoteConfiguration.rum) | ||
} else { | ||
@@ -50,8 +44,12 @@ displayRemoteConfigurationFetchingError() | ||
xhr.open('GET', `${REMOTE_CONFIGURATION_URL}/${encodeURIComponent(configuration.remoteConfigurationId!)}.json`) | ||
xhr.open('GET', buildEndpoint(configuration)) | ||
xhr.send() | ||
} | ||
export function buildEndpoint(configuration: RumInitConfiguration) { | ||
return `https://sdk-configuration.${buildEndpointHost('rum', configuration)}/${REMOTE_CONFIGURATION_VERSION}/${encodeURIComponent(configuration.remoteConfigurationId!)}.json` | ||
} | ||
function displayRemoteConfigurationFetchingError() { | ||
display.error('Error fetching the remote configuration.') | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { RelativeTime, Observable } from '@datadog/browser-core' | ||
import type { RelativeTime, Observable, Context } from '@datadog/browser-core' | ||
import { SESSION_TIME_OUT_DELAY, relativeNow, createValueHistory } from '@datadog/browser-core' | ||
@@ -22,2 +22,4 @@ import type { LocationChange } from '../../browser/locationChangeObservable' | ||
findUrl: (startTime?: RelativeTime) => UrlContext | undefined | ||
getAllEntries: () => Context[] | ||
getDeletedEntries: () => RelativeTime[] | ||
stop: () => void | ||
@@ -75,2 +77,4 @@ } | ||
findUrl: (startTime?: RelativeTime) => urlContextHistory.find(startTime), | ||
getAllEntries: () => urlContextHistory.getAllEntries(), | ||
getDeletedEntries: () => urlContextHistory.getDeletedEntries(), | ||
stop: () => { | ||
@@ -77,0 +81,0 @@ locationChangeSubscription.unsubscribe() |
@@ -5,3 +5,3 @@ import type { RelativeTime, ClocksState, Context } from '@datadog/browser-core' | ||
import { LifeCycleEventType } from '../lifeCycle' | ||
import type { ViewCreatedEvent, ViewEvent } from '../view/trackViews' | ||
import type { BeforeViewUpdateEvent, ViewCreatedEvent } from '../view/trackViews' | ||
@@ -22,2 +22,4 @@ export const VIEW_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY | ||
stop: () => void | ||
getAllEntries: () => Context[] | ||
getDeletedEntries: () => RelativeTime[] | ||
} | ||
@@ -36,3 +38,3 @@ | ||
lifeCycle.subscribe(LifeCycleEventType.VIEW_UPDATED, (viewUpdate: ViewEvent) => { | ||
lifeCycle.subscribe(LifeCycleEventType.BEFORE_VIEW_UPDATED, (viewUpdate: BeforeViewUpdateEvent) => { | ||
const currentView = viewValueHistory.find(viewUpdate.startClocks.relative) | ||
@@ -64,2 +66,4 @@ if (currentView && viewUpdate.name) { | ||
findView: (startTime) => viewValueHistory.find(startTime), | ||
getAllEntries: () => viewValueHistory.getAllEntries(), | ||
getDeletedEntries: () => viewValueHistory.getDeletedEntries(), | ||
stop: () => { | ||
@@ -66,0 +70,0 @@ viewValueHistory.stop() |
@@ -9,3 +9,3 @@ import type { Context, PageExitEvent, RawError, RelativeTime } from '@datadog/browser-core' | ||
import type { AutoAction } from './action/actionCollection' | ||
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './view/trackViews' | ||
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent, BeforeViewUpdateEvent } from './view/trackViews' | ||
@@ -18,2 +18,3 @@ export const enum LifeCycleEventType { | ||
VIEW_CREATED, | ||
BEFORE_VIEW_UPDATED, | ||
VIEW_UPDATED, | ||
@@ -60,2 +61,3 @@ VIEW_ENDED, | ||
VIEW_CREATED: LifeCycleEventType.VIEW_CREATED | ||
BEFORE_VIEW_UPDATED: LifeCycleEventType.BEFORE_VIEW_UPDATED | ||
VIEW_UPDATED: LifeCycleEventType.VIEW_UPDATED | ||
@@ -80,2 +82,3 @@ VIEW_ENDED: LifeCycleEventType.VIEW_ENDED | ||
[LifeCycleEventTypeAsConst.VIEW_CREATED]: ViewCreatedEvent | ||
[LifeCycleEventTypeAsConst.BEFORE_VIEW_UPDATED]: BeforeViewUpdateEvent | ||
[LifeCycleEventTypeAsConst.VIEW_UPDATED]: ViewEvent | ||
@@ -82,0 +85,0 @@ [LifeCycleEventTypeAsConst.VIEW_ENDED]: ViewEndedEvent |
@@ -11,8 +11,13 @@ import { runOnReadyState } from '@datadog/browser-core' | ||
configuration: RumConfiguration, | ||
callback: (timing: RumPerformanceResourceTiming) => void | ||
callback: (timing: RumPerformanceResourceTiming) => void, | ||
getNavigationEntryImpl = getNavigationEntry | ||
) { | ||
runOnReadyState(configuration, 'interactive', () => { | ||
const entry: RumPerformanceResourceTiming = Object.assign(getNavigationEntry().toJSON(), { | ||
const navigationEntry = getNavigationEntryImpl() | ||
const entry: RumPerformanceResourceTiming = Object.assign(navigationEntry.toJSON(), { | ||
entryType: RumPerformanceEntryType.RESOURCE as const, | ||
initiatorType: FAKE_INITIAL_DOCUMENT, | ||
// The ResourceTiming duration entry should be `responseEnd - startTime`. With | ||
// NavigationTiming entries, `startTime` is always 0, so set it to `responseEnd`. | ||
duration: navigationEntry.responseEnd, | ||
traceId: getDocumentTraceId(document), | ||
@@ -19,0 +24,0 @@ toJSON: () => ({ ...entry, toJSON: undefined }), |
@@ -70,2 +70,9 @@ import type { | ||
export interface BeforeViewUpdateEvent { | ||
id: string | ||
name?: string | ||
context?: Context | ||
startClocks: ClocksState | ||
} | ||
export interface ViewEndedEvent { | ||
@@ -240,9 +247,5 @@ endClocks: ClocksState | ||
// Update the view every time the measures are changing | ||
const { throttled: scheduleViewUpdate, cancel: cancelScheduleViewUpdate } = throttle( | ||
triggerViewUpdate, | ||
THROTTLE_VIEW_UPDATE_PERIOD, | ||
{ | ||
leading: false, | ||
} | ||
) | ||
const { throttled, cancel: cancelScheduleViewUpdate } = throttle(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, { | ||
leading: false, | ||
}) | ||
@@ -277,6 +280,24 @@ const { | ||
triggerViewUpdate() | ||
contextManager.changeObservable.subscribe(triggerViewUpdate) | ||
// View context update should always be throttled | ||
contextManager.changeObservable.subscribe(scheduleViewUpdate) | ||
function triggerBeforeViewUpdate() { | ||
lifeCycle.notify(LifeCycleEventType.BEFORE_VIEW_UPDATED, { | ||
id, | ||
name, | ||
context: contextManager.getContext(), | ||
startClocks, | ||
}) | ||
} | ||
function scheduleViewUpdate() { | ||
triggerBeforeViewUpdate() | ||
throttled() | ||
} | ||
function triggerViewUpdate() { | ||
cancelScheduleViewUpdate() | ||
triggerBeforeViewUpdate() | ||
documentVersion += 1 | ||
@@ -283,0 +304,0 @@ const currentEnd = endClocks === undefined ? timeStampNow() : endClocks.timeStamp |
@@ -165,4 +165,5 @@ import type { Duration, ServerDuration, Observable } from '@datadog/browser-core' | ||
target_selector: largestContentfulPaint.targetSelector, | ||
resource_url: largestContentfulPaint.resourceUrl, | ||
}, | ||
} | ||
} |
@@ -16,2 +16,3 @@ import type { RelativeTime } from '@datadog/browser-core' | ||
targetSelector?: string | ||
resourceUrl?: string | ||
} | ||
@@ -61,3 +62,2 @@ | ||
) | ||
if (lcpEntry) { | ||
@@ -72,2 +72,3 @@ let lcpTargetSelector | ||
targetSelector: lcpTargetSelector, | ||
resourceUrl: lcpEntry.url, | ||
}) | ||
@@ -74,0 +75,0 @@ biggestLcpSize = lcpEntry.size |
@@ -1,4 +0,5 @@ | ||
export { RumPublicApi, makeRumPublicApi, RecorderApi, StartRecordingOptions, Strategy } from './boot/rumPublicApi' | ||
export { StartRum } from './boot/startRum' | ||
export { | ||
export type { RumPublicApi, RecorderApi, StartRecordingOptions, Strategy } from './boot/rumPublicApi' | ||
export { makeRumPublicApi } from './boot/rumPublicApi' | ||
export type { StartRum } from './boot/startRum' | ||
export type { | ||
RumEvent, | ||
@@ -13,3 +14,3 @@ RumActionEvent, | ||
} from './rumEvent.types' | ||
export { | ||
export type { | ||
RumLongTaskEventDomainContext, | ||
@@ -24,12 +25,16 @@ RumErrorEventDomainContext, | ||
} from './domainContext.types' | ||
export { ReplayStats, ActionType, RumEventType, FrustrationType, RawRumActionEvent } from './rawRumEvent.types' | ||
export type { ReplayStats, RawRumActionEvent } from './rawRumEvent.types' | ||
export { ActionType, RumEventType, FrustrationType } from './rawRumEvent.types' | ||
export { startRum } from './boot/startRum' | ||
export { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from './domain/lifeCycle' | ||
export { ViewCreatedEvent } from './domain/view/trackViews' | ||
export { ViewHistoryEntry, ViewHistory, startViewHistory } from './domain/contexts/viewHistory' | ||
export { RumSessionManager, RumSession } from './domain/rumSessionManager' | ||
export type { RawRumEventCollectedData } from './domain/lifeCycle' | ||
export { LifeCycle, LifeCycleEventType } from './domain/lifeCycle' | ||
export type { ViewCreatedEvent } from './domain/view/trackViews' | ||
export type { ViewHistoryEntry, ViewHistory } from './domain/contexts/viewHistory' | ||
export { startViewHistory } from './domain/contexts/viewHistory' | ||
export type { RumSessionManager, RumSession } from './domain/rumSessionManager' | ||
export { getMutationObserverConstructor } from './browser/domMutationObservable' | ||
export { initViewportObservable, getViewportDimension, ViewportDimension } from './browser/viewportObservable' | ||
export type { ViewportDimension } from './browser/viewportObservable' | ||
export { initViewportObservable, getViewportDimension } from './browser/viewportObservable' | ||
export { getScrollX, getScrollY } from './browser/scroll' | ||
export { RumInitConfiguration, RumConfiguration, RumRemoteConfiguration } from './domain/configuration' | ||
export type { RumInitConfiguration, RumConfiguration } from './domain/configuration' | ||
export { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './domain/action/getActionNameFromElement' | ||
@@ -36,0 +41,0 @@ export { STABLE_ATTRIBUTES } from './domain/getSelectorFromElement' |
@@ -178,2 +178,3 @@ import type { | ||
target_selector?: string | ||
resource_url?: string | ||
} | ||
@@ -180,0 +181,0 @@ } |
@@ -1715,2 +1715,6 @@ /* eslint-disable */ | ||
readonly target_selector?: string | ||
/** | ||
* URL of the largest contentful paint element | ||
*/ | ||
readonly resource_url?: string | ||
[k: string]: unknown | ||
@@ -1717,0 +1721,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
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
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
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
1587079
29267
+ Added@datadog/browser-core@6.2.0(transitive)
- Removed@datadog/browser-core@6.1.0(transitive)
Updated@datadog/browser-core@6.2.0