@datadog/browser-rum-core
Advanced tools
Comparing version 3.6.6 to 3.6.8
@@ -6,4 +6,4 @@ "use strict"; | ||
buildMode: 'release', | ||
sdkVersion: '3.6.6', | ||
sdkVersion: '3.6.8', | ||
}; | ||
//# sourceMappingURL=buildEnv.js.map |
@@ -33,5 +33,3 @@ "use strict"; | ||
var _a = startRumEventCollection(initConfiguration.applicationId, lifeCycle, configuration, location, session, locationChangeObservable, getCommonContext), parentContexts = _a.parentContexts, foregroundContexts = _a.foregroundContexts, urlContexts = _a.urlContexts; | ||
if (session.hasReplayPlan()) { | ||
longTaskCollection_1.startLongTaskCollection(lifeCycle); | ||
} | ||
longTaskCollection_1.startLongTaskCollection(lifeCycle, session); | ||
resourceCollection_1.startResourceCollection(lifeCycle); | ||
@@ -38,0 +36,0 @@ var _b = viewCollection_1.startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, foregroundContexts, recorderApi, initialViewName), addTiming = _b.addTiming, startView = _b.startView; |
@@ -8,3 +8,3 @@ "use strict"; | ||
var trackEventCounts_1 = require("../../trackEventCounts"); | ||
var trackPageActivities_1 = require("../../trackPageActivities"); | ||
var waitIdlePage_1 = require("../../waitIdlePage"); | ||
var getActionNameFromElement_1 = require("./getActionNameFromElement"); | ||
@@ -40,3 +40,3 @@ // Maximum duration for automatic actions | ||
var currentAction; | ||
var currentIdlePageActivitySubscription; | ||
var stopWaitingIdlePage; | ||
return { | ||
@@ -50,5 +50,5 @@ create: function (type, name, event) { | ||
currentAction = pendingAutoAction; | ||
currentIdlePageActivitySubscription = trackPageActivities_1.waitIdlePageActivity(lifeCycle, domMutationObservable, function (params) { | ||
if (params.hadActivity) { | ||
pendingAutoAction.complete(params.endTime); | ||
(stopWaitingIdlePage = waitIdlePage_1.waitIdlePage(lifeCycle, domMutationObservable, function (event) { | ||
if (event.hadActivity) { | ||
pendingAutoAction.complete(event.endClocks); | ||
} | ||
@@ -59,7 +59,7 @@ else { | ||
currentAction = undefined; | ||
}, exports.AUTO_ACTION_MAX_DURATION); | ||
}, exports.AUTO_ACTION_MAX_DURATION).stop); | ||
}, | ||
discardCurrent: function () { | ||
if (currentAction) { | ||
currentIdlePageActivitySubscription.stop(); | ||
stopWaitingIdlePage(); | ||
currentAction.discard(); | ||
@@ -82,3 +82,15 @@ currentAction = undefined; | ||
} | ||
PendingAutoAction.prototype.complete = function (endTime) { | ||
PendingAutoAction.prototype.complete = function (endClocks) { | ||
var actionDuration = browser_core_1.elapsed(this.startClocks.timeStamp, endClocks.timeStamp); | ||
if (actionDuration < 0) { | ||
browser_core_1.addMonitoringMessage('auto action with negative loading time', { | ||
debug: { | ||
actionDuration: actionDuration, | ||
type: this.type, | ||
name: this.name, | ||
startClocks: this.startClocks, | ||
endClocks: endClocks, | ||
}, | ||
}); | ||
} | ||
var eventCounts = this.eventCountsSubscription.eventCounts; | ||
@@ -91,3 +103,3 @@ this.lifeCycle.notify(lifeCycle_1.LifeCycleEventType.AUTO_ACTION_COMPLETED, { | ||
}, | ||
duration: browser_core_1.elapsed(this.startClocks.timeStamp, endTime), | ||
duration: actionDuration, | ||
id: this.id, | ||
@@ -94,0 +106,0 @@ name: this.name, |
import { LifeCycle } from '../../lifeCycle'; | ||
export declare function startLongTaskCollection(lifeCycle: LifeCycle): void; | ||
import { RumSession } from '../../rumSession'; | ||
export declare function startLongTaskCollection(lifeCycle: LifeCycle, session: RumSession): void; |
@@ -7,5 +7,5 @@ "use strict"; | ||
var lifeCycle_1 = require("../../lifeCycle"); | ||
function startLongTaskCollection(lifeCycle) { | ||
function startLongTaskCollection(lifeCycle, session) { | ||
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) { | ||
if (entry.entryType !== 'longtask') { | ||
if (entry.entryType !== 'longtask' || session.hasLitePlan()) { | ||
return; | ||
@@ -12,0 +12,0 @@ } |
@@ -85,5 +85,8 @@ "use strict"; | ||
}, { capture: true, once: true }).stop; | ||
var isFirstLCP = true; | ||
var unsubscribeLifeCycle = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) { | ||
if (entry.entryType === 'largest-contentful-paint' && | ||
entry.startTime < firstInteractionTimestamp && | ||
if (entry.entryType !== 'largest-contentful-paint') { | ||
return; | ||
} | ||
if (entry.startTime < firstInteractionTimestamp && | ||
entry.startTime < firstHidden.timeStamp && | ||
@@ -93,2 +96,19 @@ entry.startTime < exports.TIMING_MAXIMUM_DELAY) { | ||
} | ||
else if (isFirstLCP && browser_core_1.isExperimentalFeatureEnabled('monitor-dropped-lcp')) { | ||
var reason = entry.startTime >= firstInteractionTimestamp | ||
? 'after interaction' | ||
: entry.startTime >= firstHidden.timeStamp | ||
? 'after hidden' | ||
: entry.startTime >= exports.TIMING_MAXIMUM_DELAY | ||
? 'after maximum delay' | ||
: 'N/A'; | ||
browser_core_1.addMonitoringMessage("LCP dropped " + reason, { | ||
debug: { | ||
startTime: entry.startTime, | ||
firstInteractionTimestamp: firstInteractionTimestamp, | ||
firstHiddenTimestamp: firstHidden.timeStamp, | ||
}, | ||
}); | ||
} | ||
isFirstLCP = false; | ||
}).unsubscribe; | ||
@@ -95,0 +115,0 @@ return { |
@@ -9,3 +9,3 @@ "use strict"; | ||
var trackEventCounts_1 = require("../../trackEventCounts"); | ||
var trackPageActivities_1 = require("../../trackPageActivities"); | ||
var waitIdlePage_1 = require("../../waitIdlePage"); | ||
function trackViewMetrics(lifeCycle, domMutationObservable, scheduleViewUpdate, loadingType) { | ||
@@ -81,5 +81,5 @@ var viewMetrics = { | ||
var startTime = browser_core_1.timeStampNow(); | ||
var stopWaitIdlePageActivity = trackPageActivities_1.waitIdlePageActivity(lifeCycle, domMutationObservable, function (params) { | ||
return waitIdlePage_1.waitIdlePage(lifeCycle, domMutationObservable, function (params) { | ||
if (params.hadActivity) { | ||
callback(browser_core_1.elapsed(startTime, params.endTime)); | ||
callback(browser_core_1.elapsed(startTime, params.endClocks.timeStamp)); | ||
} | ||
@@ -89,4 +89,3 @@ else { | ||
} | ||
}).stop; | ||
return { stop: stopWaitIdlePageActivity }; | ||
}); | ||
} | ||
@@ -93,0 +92,0 @@ /** |
export var buildEnv = { | ||
buildMode: 'release', | ||
sdkVersion: '3.6.6', | ||
sdkVersion: '3.6.8', | ||
}; | ||
//# sourceMappingURL=buildEnv.js.map |
@@ -30,5 +30,3 @@ import { combine } from '@datadog/browser-core'; | ||
var _a = startRumEventCollection(initConfiguration.applicationId, lifeCycle, configuration, location, session, locationChangeObservable, getCommonContext), parentContexts = _a.parentContexts, foregroundContexts = _a.foregroundContexts, urlContexts = _a.urlContexts; | ||
if (session.hasReplayPlan()) { | ||
startLongTaskCollection(lifeCycle); | ||
} | ||
startLongTaskCollection(lifeCycle, session); | ||
startResourceCollection(lifeCycle); | ||
@@ -35,0 +33,0 @@ var _b = startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, foregroundContexts, recorderApi, initialViewName), addTiming = _b.addTiming, startView = _b.startView; |
@@ -1,6 +0,6 @@ | ||
import { addEventListener, elapsed, generateUUID, clocksNow, ONE_SECOND, } from '@datadog/browser-core'; | ||
import { addEventListener, elapsed, generateUUID, clocksNow, ONE_SECOND, addMonitoringMessage, } from '@datadog/browser-core'; | ||
import { ActionType } from '../../../rawRumEvent.types'; | ||
import { LifeCycleEventType } from '../../lifeCycle'; | ||
import { trackEventCounts } from '../../trackEventCounts'; | ||
import { waitIdlePageActivity } from '../../trackPageActivities'; | ||
import { waitIdlePage } from '../../waitIdlePage'; | ||
import { getActionNameFromElement } from './getActionNameFromElement'; | ||
@@ -35,3 +35,3 @@ // Maximum duration for automatic actions | ||
var currentAction; | ||
var currentIdlePageActivitySubscription; | ||
var stopWaitingIdlePage; | ||
return { | ||
@@ -45,5 +45,5 @@ create: function (type, name, event) { | ||
currentAction = pendingAutoAction; | ||
currentIdlePageActivitySubscription = waitIdlePageActivity(lifeCycle, domMutationObservable, function (params) { | ||
if (params.hadActivity) { | ||
pendingAutoAction.complete(params.endTime); | ||
(stopWaitingIdlePage = waitIdlePage(lifeCycle, domMutationObservable, function (event) { | ||
if (event.hadActivity) { | ||
pendingAutoAction.complete(event.endClocks); | ||
} | ||
@@ -54,7 +54,7 @@ else { | ||
currentAction = undefined; | ||
}, AUTO_ACTION_MAX_DURATION); | ||
}, AUTO_ACTION_MAX_DURATION).stop); | ||
}, | ||
discardCurrent: function () { | ||
if (currentAction) { | ||
currentIdlePageActivitySubscription.stop(); | ||
stopWaitingIdlePage(); | ||
currentAction.discard(); | ||
@@ -77,3 +77,15 @@ currentAction = undefined; | ||
} | ||
PendingAutoAction.prototype.complete = function (endTime) { | ||
PendingAutoAction.prototype.complete = function (endClocks) { | ||
var actionDuration = elapsed(this.startClocks.timeStamp, endClocks.timeStamp); | ||
if (actionDuration < 0) { | ||
addMonitoringMessage('auto action with negative loading time', { | ||
debug: { | ||
actionDuration: actionDuration, | ||
type: this.type, | ||
name: this.name, | ||
startClocks: this.startClocks, | ||
endClocks: endClocks, | ||
}, | ||
}); | ||
} | ||
var eventCounts = this.eventCountsSubscription.eventCounts; | ||
@@ -86,3 +98,3 @@ this.lifeCycle.notify(LifeCycleEventType.AUTO_ACTION_COMPLETED, { | ||
}, | ||
duration: elapsed(this.startClocks.timeStamp, endTime), | ||
duration: actionDuration, | ||
id: this.id, | ||
@@ -89,0 +101,0 @@ name: this.name, |
import { LifeCycle } from '../../lifeCycle'; | ||
export declare function startLongTaskCollection(lifeCycle: LifeCycle): void; | ||
import { RumSession } from '../../rumSession'; | ||
export declare function startLongTaskCollection(lifeCycle: LifeCycle, session: RumSession): void; |
import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core'; | ||
import { RumEventType } from '../../../rawRumEvent.types'; | ||
import { LifeCycleEventType } from '../../lifeCycle'; | ||
export function startLongTaskCollection(lifeCycle) { | ||
export function startLongTaskCollection(lifeCycle, session) { | ||
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) { | ||
if (entry.entryType !== 'longtask') { | ||
if (entry.entryType !== 'longtask' || session.hasLitePlan()) { | ||
return; | ||
@@ -8,0 +8,0 @@ } |
import { __assign } from "tslib"; | ||
import { addEventListeners, elapsed, ONE_MINUTE, } from '@datadog/browser-core'; | ||
import { addEventListeners, elapsed, ONE_MINUTE, addMonitoringMessage, isExperimentalFeatureEnabled, } from '@datadog/browser-core'; | ||
import { LifeCycleEventType } from '../../lifeCycle'; | ||
@@ -79,5 +79,8 @@ import { trackFirstHidden } from './trackFirstHidden'; | ||
}, { capture: true, once: true }).stop; | ||
var isFirstLCP = true; | ||
var unsubscribeLifeCycle = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) { | ||
if (entry.entryType === 'largest-contentful-paint' && | ||
entry.startTime < firstInteractionTimestamp && | ||
if (entry.entryType !== 'largest-contentful-paint') { | ||
return; | ||
} | ||
if (entry.startTime < firstInteractionTimestamp && | ||
entry.startTime < firstHidden.timeStamp && | ||
@@ -87,2 +90,19 @@ entry.startTime < TIMING_MAXIMUM_DELAY) { | ||
} | ||
else if (isFirstLCP && isExperimentalFeatureEnabled('monitor-dropped-lcp')) { | ||
var reason = entry.startTime >= firstInteractionTimestamp | ||
? 'after interaction' | ||
: entry.startTime >= firstHidden.timeStamp | ||
? 'after hidden' | ||
: entry.startTime >= TIMING_MAXIMUM_DELAY | ||
? 'after maximum delay' | ||
: 'N/A'; | ||
addMonitoringMessage("LCP dropped " + reason, { | ||
debug: { | ||
startTime: entry.startTime, | ||
firstInteractionTimestamp: firstInteractionTimestamp, | ||
firstHiddenTimestamp: firstHidden.timeStamp, | ||
}, | ||
}); | ||
} | ||
isFirstLCP = false; | ||
}).unsubscribe; | ||
@@ -89,0 +109,0 @@ return { |
@@ -6,3 +6,3 @@ import { noop, elapsed, round, timeStampNow, ONE_SECOND, } from '@datadog/browser-core'; | ||
import { trackEventCounts } from '../../trackEventCounts'; | ||
import { waitIdlePageActivity } from '../../trackPageActivities'; | ||
import { waitIdlePage } from '../../waitIdlePage'; | ||
export function trackViewMetrics(lifeCycle, domMutationObservable, scheduleViewUpdate, loadingType) { | ||
@@ -77,5 +77,5 @@ var viewMetrics = { | ||
var startTime = timeStampNow(); | ||
var stopWaitIdlePageActivity = waitIdlePageActivity(lifeCycle, domMutationObservable, function (params) { | ||
return waitIdlePage(lifeCycle, domMutationObservable, function (params) { | ||
if (params.hadActivity) { | ||
callback(elapsed(startTime, params.endTime)); | ||
callback(elapsed(startTime, params.endClocks.timeStamp)); | ||
} | ||
@@ -85,4 +85,3 @@ else { | ||
} | ||
}).stop; | ||
return { stop: stopWaitIdlePageActivity }; | ||
}); | ||
} | ||
@@ -89,0 +88,0 @@ /** |
{ | ||
"name": "@datadog/browser-rum-core", | ||
"version": "3.6.6", | ||
"version": "3.6.8", | ||
"license": "Apache-2.0", | ||
@@ -15,3 +15,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@datadog/browser-core": "3.6.6", | ||
"@datadog/browser-core": "3.6.8", | ||
"tslib": "^1.10.0" | ||
@@ -27,3 +27,3 @@ }, | ||
}, | ||
"gitHead": "8cf204992bd6936714b438fc220bd0039771fe7e" | ||
"gitHead": "af55827d054171d9c150905b39ffe629c0cc8f17" | ||
} |
import { RelativeTime, Configuration, Observable, noop, relativeNow } from '@datadog/browser-core' | ||
import { RumSession } from '@datadog/browser-rum-core' | ||
import { createRumSessionMock, RumSessionMock } from '../../test/mockRumSession' | ||
@@ -14,2 +13,3 @@ import { isIE } from '../../../core/test/specHelper' | ||
import { startLongTaskCollection } from '../domain/rumEventsCollection/longTask/longTaskCollection' | ||
import { RumSession } from '..' | ||
import { startRumEventCollection } from './startRum' | ||
@@ -56,3 +56,3 @@ | ||
startLongTaskCollection(lifeCycle) | ||
startLongTaskCollection(lifeCycle, session) | ||
return { | ||
@@ -59,0 +59,0 @@ stop: () => { |
@@ -55,5 +55,3 @@ import { combine, Configuration, InternalMonitoring, Observable } from '@datadog/browser-core' | ||
if (session.hasReplayPlan()) { | ||
startLongTaskCollection(lifeCycle) | ||
} | ||
startLongTaskCollection(lifeCycle, session) | ||
startResourceCollection(lifeCycle) | ||
@@ -60,0 +58,0 @@ const { addTiming, startView } = startViewCollection( |
@@ -14,5 +14,2 @@ import { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core' | ||
setupBuilder = setup() | ||
.withConfiguration({ | ||
isEnabled: () => true, | ||
}) | ||
.withForegroundContexts({ | ||
@@ -19,0 +16,0 @@ isInForegroundAt: () => true, |
@@ -7,3 +7,3 @@ import { Context, DOM_EVENT, ClocksState, Observable } from '@datadog/browser-core' | ||
import { LifeCycleEventType } from '../../lifeCycle' | ||
import { PAGE_ACTIVITY_VALIDATION_DELAY } from '../../trackPageActivities' | ||
import { PAGE_ACTIVITY_VALIDATION_DELAY } from '../../waitIdlePage' | ||
import { AutoAction, AUTO_ACTION_MAX_DURATION, trackActions } from './trackActions' | ||
@@ -10,0 +10,0 @@ |
@@ -10,6 +10,6 @@ import { | ||
clocksNow, | ||
TimeStamp, | ||
Configuration, | ||
ONE_SECOND, | ||
Observable, | ||
addMonitoringMessage, | ||
} from '@datadog/browser-core' | ||
@@ -19,3 +19,3 @@ import { ActionType } from '../../../rawRumEvent.types' | ||
import { EventCounts, trackEventCounts } from '../../trackEventCounts' | ||
import { waitIdlePageActivity } from '../../trackPageActivities' | ||
import { waitIdlePage } from '../../waitIdlePage' | ||
import { getActionNameFromElement } from './getActionNameFromElement' | ||
@@ -95,3 +95,3 @@ | ||
let currentAction: PendingAutoAction | undefined | ||
let currentIdlePageActivitySubscription: { stop: () => void } | ||
let stopWaitingIdlePage: () => void | ||
@@ -105,10 +105,9 @@ return { | ||
const pendingAutoAction = new PendingAutoAction(lifeCycle, type, name, event) | ||
currentAction = pendingAutoAction | ||
currentIdlePageActivitySubscription = waitIdlePageActivity( | ||
;({ stop: stopWaitingIdlePage } = waitIdlePage( | ||
lifeCycle, | ||
domMutationObservable, | ||
(params) => { | ||
if (params.hadActivity) { | ||
pendingAutoAction.complete(params.endTime) | ||
(event) => { | ||
if (event.hadActivity) { | ||
pendingAutoAction.complete(event.endClocks) | ||
} else { | ||
@@ -120,7 +119,7 @@ pendingAutoAction.discard() | ||
AUTO_ACTION_MAX_DURATION | ||
) | ||
)) | ||
}, | ||
discardCurrent: () => { | ||
if (currentAction) { | ||
currentIdlePageActivitySubscription.stop() | ||
stopWaitingIdlePage() | ||
currentAction.discard() | ||
@@ -145,3 +144,16 @@ currentAction = undefined | ||
complete(endTime: TimeStamp) { | ||
complete(endClocks: ClocksState) { | ||
const actionDuration = elapsed(this.startClocks.timeStamp, endClocks.timeStamp) | ||
if (actionDuration < 0) { | ||
addMonitoringMessage('auto action with negative loading time', { | ||
debug: { | ||
actionDuration, | ||
type: this.type, | ||
name: this.name, | ||
startClocks: this.startClocks, | ||
endClocks, | ||
}, | ||
}) | ||
} | ||
const eventCounts = this.eventCountsSubscription.eventCounts | ||
@@ -154,3 +166,3 @@ this.lifeCycle.notify(LifeCycleEventType.AUTO_ACTION_COMPLETED, { | ||
}, | ||
duration: elapsed(this.startClocks.timeStamp, endTime), | ||
duration: actionDuration, | ||
id: this.id, | ||
@@ -157,0 +169,0 @@ name: this.name, |
@@ -13,5 +13,2 @@ import { ErrorHandling, ErrorSource, RelativeTime, TimeStamp } from '@datadog/browser-core' | ||
setupBuilder = setup() | ||
.withConfiguration({ | ||
isEnabled: () => true, | ||
}) | ||
.withForegroundContexts({ | ||
@@ -18,0 +15,0 @@ isInForegroundAt: () => true, |
import { Duration, RelativeTime, ServerDuration } from '@datadog/browser-core' | ||
import { createRumSessionMock, RumSessionMock } from '../../../../test/mockRumSession' | ||
import { setup, TestSetupBuilder } from '../../../../test/specHelper' | ||
@@ -19,11 +20,10 @@ import { RumPerformanceEntry, RumPerformanceLongTaskTiming } from '../../../browser/performanceCollection' | ||
let setupBuilder: TestSetupBuilder | ||
let session: RumSessionMock | ||
beforeEach(() => { | ||
session = createRumSessionMock() | ||
setupBuilder = setup() | ||
.withConfiguration({ | ||
isEnabled: () => true, | ||
.withSession(session) | ||
.beforeBuild(({ lifeCycle, session }) => { | ||
startLongTaskCollection(lifeCycle, session) | ||
}) | ||
.beforeBuild(({ lifeCycle }) => { | ||
startLongTaskCollection(lifeCycle) | ||
}) | ||
}) | ||
@@ -48,2 +48,14 @@ | ||
it('should only collect when session has a replay plan', () => { | ||
const { lifeCycle, rawRumEvents } = setupBuilder.build() | ||
session.setReplayPlan() | ||
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, LONG_TASK) | ||
expect(rawRumEvents.length).toBe(1) | ||
session.setLitePlan() | ||
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, LONG_TASK) | ||
expect(rawRumEvents.length).toBe(1) | ||
}) | ||
it('should create raw rum event from performance entry', () => { | ||
@@ -50,0 +62,0 @@ const { lifeCycle, rawRumEvents } = setupBuilder.build() |
import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core' | ||
import { RawRumLongTaskEvent, RumEventType } from '../../../rawRumEvent.types' | ||
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle' | ||
import { RumSession } from '../../rumSession' | ||
export function startLongTaskCollection(lifeCycle: LifeCycle) { | ||
export function startLongTaskCollection(lifeCycle: LifeCycle, session: RumSession) { | ||
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => { | ||
if (entry.entryType !== 'longtask') { | ||
if (entry.entryType !== 'longtask' || session.hasLitePlan()) { | ||
return | ||
@@ -9,0 +10,0 @@ } |
@@ -9,2 +9,4 @@ import { | ||
ONE_MINUTE, | ||
addMonitoringMessage, | ||
isExperimentalFeatureEnabled, | ||
} from '@datadog/browser-core' | ||
@@ -118,7 +120,11 @@ import { LifeCycle, LifeCycleEventType } from '../../lifeCycle' | ||
let isFirstLCP = true | ||
const { unsubscribe: unsubscribeLifeCycle } = lifeCycle.subscribe( | ||
LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, | ||
(entry) => { | ||
if (entry.entryType !== 'largest-contentful-paint') { | ||
return | ||
} | ||
if ( | ||
entry.entryType === 'largest-contentful-paint' && | ||
entry.startTime < firstInteractionTimestamp && | ||
@@ -129,3 +135,21 @@ entry.startTime < firstHidden.timeStamp && | ||
callback(entry.startTime) | ||
} else if (isFirstLCP && isExperimentalFeatureEnabled('monitor-dropped-lcp')) { | ||
const reason = | ||
entry.startTime >= firstInteractionTimestamp | ||
? 'after interaction' | ||
: entry.startTime >= firstHidden.timeStamp | ||
? 'after hidden' | ||
: entry.startTime >= TIMING_MAXIMUM_DELAY | ||
? 'after maximum delay' | ||
: 'N/A' | ||
addMonitoringMessage(`LCP dropped ${reason}`, { | ||
debug: { | ||
startTime: entry.startTime, | ||
firstInteractionTimestamp, | ||
firstHiddenTimestamp: firstHidden.timeStamp, | ||
}, | ||
}) | ||
} | ||
isFirstLCP = false | ||
} | ||
@@ -132,0 +156,0 @@ ) |
@@ -7,3 +7,3 @@ import { Context, RelativeTime, Duration, relativeNow } from '@datadog/browser-core' | ||
import { LifeCycle } from '../../lifeCycle' | ||
import { PAGE_ACTIVITY_END_DELAY, PAGE_ACTIVITY_VALIDATION_DELAY } from '../../trackPageActivities' | ||
import { PAGE_ACTIVITY_END_DELAY, PAGE_ACTIVITY_VALIDATION_DELAY } from '../../waitIdlePage' | ||
import { THROTTLE_VIEW_UPDATE_PERIOD } from './trackViews' | ||
@@ -10,0 +10,0 @@ |
@@ -15,3 +15,3 @@ import { | ||
import { EventCounts, trackEventCounts } from '../../trackEventCounts' | ||
import { waitIdlePageActivity } from '../../trackPageActivities' | ||
import { waitIdlePage } from '../../waitIdlePage' | ||
@@ -112,5 +112,5 @@ export interface ViewMetrics { | ||
const startTime = timeStampNow() | ||
const { stop: stopWaitIdlePageActivity } = waitIdlePageActivity(lifeCycle, domMutationObservable, (params) => { | ||
return waitIdlePage(lifeCycle, domMutationObservable, (params) => { | ||
if (params.hadActivity) { | ||
callback(elapsed(startTime, params.endTime)) | ||
callback(elapsed(startTime, params.endClocks.timeStamp)) | ||
} else { | ||
@@ -120,4 +120,2 @@ callback(undefined) | ||
}) | ||
return { stop: stopWaitIdlePageActivity } | ||
} | ||
@@ -124,0 +122,0 @@ |
@@ -48,5 +48,2 @@ import { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core' | ||
setupBuilder = setup() | ||
.withConfiguration({ | ||
isEnabled: () => true, | ||
}) | ||
.withForegroundContexts({ | ||
@@ -53,0 +50,0 @@ selectInForegroundPeriodsFor: () => [{ start: 0 as ServerDuration, duration: 10 as ServerDuration }], |
@@ -23,3 +23,2 @@ import { | ||
...DEFAULT_CONFIGURATION, | ||
isEnabled: () => true, | ||
sampleRate: 50, | ||
@@ -26,0 +25,0 @@ replaySampleRate: 50, |
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
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
979229
20027
+ Added@datadog/browser-core@3.6.8(transitive)
- Removed@datadog/browser-core@3.6.6(transitive)
Updated@datadog/browser-core@3.6.8