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-1209] introduce "dead" and "error" frustration types #1487

Merged
merged 19 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
3b4a283
♻️✅ [RUMF-1209] merge trackActions tests
BenoitZugmeyer Apr 5, 2022
c4e51a8
♻️ [RUMF-1209] frustration detection groundwork
BenoitZugmeyer Apr 5, 2022
8d40c96
✨ [RUMF-1209] introduce "dead" and "error" frustration types
BenoitZugmeyer Apr 5, 2022
d75351f
✨ [RUMF-1209] add frustration_types on actions events
BenoitZugmeyer Mar 30, 2022
4ec2927
✅ [RUMF-1209] add frustration related tests to trackActions
BenoitZugmeyer Apr 5, 2022
12deb15
👌 replace 'a action' to 'an action'
BenoitZugmeyer Apr 20, 2022
4095ac3
👌 remove TrackActionsState, replace with closures
BenoitZugmeyer Apr 20, 2022
62fbb90
👌🐛 do not set a duration for dead clicks
BenoitZugmeyer Apr 20, 2022
48e4b0a
👌 rename endClick to stopClickProcessing
BenoitZugmeyer Apr 20, 2022
4c59a4e
👌 simplify PotentialAction
BenoitZugmeyer Apr 20, 2022
266ab17
✅👌 add e2e tests
BenoitZugmeyer Apr 21, 2022
46837d3
specialize `trackAction` to `trackClickActions`
BenoitZugmeyer Apr 26, 2022
9fe95f8
unify action namings
BenoitZugmeyer Apr 26, 2022
9d51fe1
👌✅ add a e2e test for multiple frustrations
BenoitZugmeyer Apr 27, 2022
94a2f0a
👌 more explicit type for id history
BenoitZugmeyer Apr 27, 2022
00689e0
👌 replace unnecessary call to isExperimentalFeatureEnabled
BenoitZugmeyer Apr 27, 2022
7dc2112
👌 use a helper to transform a Set to an Array
BenoitZugmeyer Apr 27, 2022
125a6df
🏷️ [RUMF-1209] add "ES2015" to the test app tsconfig
BenoitZugmeyer Apr 21, 2022
6b75376
Merge branch 'main' into benoit/frustration-signals-1
BenoitZugmeyer Apr 28, 2022
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
10 changes: 7 additions & 3 deletions packages/core/src/tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,14 @@ export function requestIdleCallback(callback: () => void, opts?: { timeout?: num
return () => window.cancelAnimationFrame(id)
}

export function setToArray<T>(set: Set<T>): T[] {
const array: T[] = []
set.forEach((item) => array.push(item))
return array
}

export function removeDuplicates<T>(array: T[]) {
const deduplicated: T[] = []
const set = new Set<T>()
array.forEach((item) => set.add(item))
set.forEach((item) => deduplicated.push(item))
return deduplicated
return setToArray(set)
}
2 changes: 1 addition & 1 deletion packages/rum-core/src/domain/lifeCycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { RumEventDomainContext } from '../domainContext.types'
import type { CommonContext, RawRumEvent } from '../rawRumEvent.types'
import type { RumEvent } from '../rumEvent.types'
import type { RequestCompleteEvent, RequestStartEvent } from './requestCollection'
import type { AutoAction } from './rumEventsCollection/action/trackActions'
import type { AutoAction } from './rumEventsCollection/action/actionCollection'
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews'

export const enum LifeCycleEventType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('actionCollection', () => {
longTaskCount: 10,
resourceCount: 10,
},
frustrationTypes: [],
duration: 100 as Duration,
id: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
name: 'foo',
Expand All @@ -48,6 +49,7 @@ describe('actionCollection', () => {
},
id: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
loading_time: (100 * 1e6) as ServerDuration,
frustration_type: [],
long_task: {
count: 10,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Observable } from '@datadog/browser-core'
import type { ClocksState, Context, Observable } from '@datadog/browser-core'
import { noop, assign, combine, toServerDuration, generateUUID } from '@datadog/browser-core'

import type { CommonContext, RawRumActionEvent } from '../../../rawRumEvent.types'
Expand All @@ -7,11 +7,20 @@ import type { LifeCycle, RawRumEventCollectedData } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { ForegroundContexts } from '../../foregroundContexts'
import type { RumConfiguration } from '../../configuration'
import type { ActionContexts, AutoAction, CustomAction } from './trackActions'
import { trackActions } from './trackActions'
import type { ActionContexts, ClickAction } from './trackClickActions'
import { trackClickActions } from './trackClickActions'

export type { ActionContexts }

export interface CustomAction {
type: ActionType.CUSTOM
name: string
startClocks: ClocksState
context?: Context
}

export type AutoAction = ClickAction

export function startActionCollection(
lifeCycle: LifeCycle,
domMutationObservable: Observable<void>,
Expand All @@ -24,7 +33,7 @@ export function startActionCollection(

let actionContexts: ActionContexts = { findActionId: noop as () => undefined }
if (configuration.trackInteractions) {
actionContexts = trackActions(lifeCycle, domMutationObservable, configuration).actionContexts
actionContexts = trackClickActions(lifeCycle, domMutationObservable, configuration).actionContexts
}

return {
Expand All @@ -50,11 +59,12 @@ function processAction(
const autoActionProperties = isAutoAction(action)
? {
action: {
id: action.id,
loading_time: toServerDuration(action.duration),
frustration_type: action.frustrationTypes,
error: {
count: action.counts.errorCount,
},
id: action.id,
loading_time: toServerDuration(action.duration),
long_task: {
count: action.counts.longTaskCount,
},
Expand Down

This file was deleted.

Loading