Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [RUMF-1499] Don't send duration for resources crossing a page frozen state #2271

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/core/src/tools/experimentalFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export enum ExperimentalFeature {
RESOURCE_PAGE_STATES = 'resource_page_states',
PAGE_STATES = 'page_states',
COLLECT_FLUSH_REASON = 'collect_flush_reason',
NO_RESOURCE_DURATION_FROZEN_STATE = 'no_resource_duration_frozen_state',
}

const enabledExperimentalFeatures: Set<ExperimentalFeature> = new Set()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ describe('resourceCollection', () => {
expect(rawRumResourceEventEntry._dd.page_states).toEqual(jasmine.objectContaining(mockPageStates))
})

it('should not have a duration if a frozen state happens during the request and no performance entry matches when NO_RESOURCE_DURATION_FROZEN_STATE enabled', () => {
addExperimentalFeatures([ExperimentalFeature.NO_RESOURCE_DURATION_FROZEN_STATE])
it('should not have a duration if a frozen state happens during the request and no performance entry matches', () => {
const { lifeCycle, rawRumEvents } = setupBuilder.build()
const mockPageStates = [{ state: PageState.FROZEN, startTime: 0 as RelativeTime }]
const mockXHR = createCompletedRequest()
Expand All @@ -146,19 +145,6 @@ describe('resourceCollection', () => {
expect(rawRumResourceEventFetch.resource.duration).toBeUndefined()
})

it('should have a duration if a frozen state happens during the request and no performance entry matches when NO_RESOURCE_DURATION_FROZEN_STATE disabled', () => {
const { lifeCycle, rawRumEvents } = setupBuilder.build()
const mockPageStates = [{ state: PageState.FROZEN, startTime: 0 as RelativeTime }]
const mockXHR = createCompletedRequest()

pageStateHistorySpy.and.returnValue(mockPageStates)

lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, mockXHR)

const rawRumResourceEventFetch = rawRumEvents[0].rawRumEvent as RawRumResourceEvent
expect(rawRumResourceEventFetch.resource.duration).toBeDefined()
})

it('should not collect page states on resources when ff resource_page_states disabled', () => {
const { lifeCycle, rawRumEvents } = setupBuilder.build()
const mockPageStates = [{ state: PageState.ACTIVE, startTime: 0 as RelativeTime }]
Expand All @@ -173,7 +159,6 @@ describe('resourceCollection', () => {
const rawRumResourceEventFetch = rawRumEvents[0].rawRumEvent as RawRumResourceEvent
const rawRumResourceEventEntry = rawRumEvents[1].rawRumEvent as RawRumResourceEvent

expect(pageStateHistorySpy).not.toHaveBeenCalled()
expect(rawRumResourceEventFetch._dd.page_states).not.toBeDefined()
expect(rawRumResourceEventEntry._dd.page_states).not.toBeDefined()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@ function computePageStateInfo(pageStateHistory: PageStateHistory, startClocks: C
}

function computeRequestDuration(pageStateHistory: PageStateHistory, startClocks: ClocksState, duration: Duration) {
// TODO remove FF in next major
if (!isExperimentalFeatureEnabled(ExperimentalFeature.NO_RESOURCE_DURATION_FROZEN_STATE)) {
return toServerDuration(duration)
}

const requestCrossedFrozenState = pageStateHistory
.findAll(startClocks.relative, duration)
?.some((pageState) => pageState.state === PageState.FROZEN)
Expand Down