Skip to content

Commit 9ad65fe

Browse files
committed
Merge branch 'main' into aymeric/fix-long-task-action-link
2 parents 659f9f8 + a55b1fb commit 9ad65fe

20 files changed

+315
-450
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Order is important, the last matching pattern takes the most precedence.
22

3+
# Default
4+
* @Datadog/rum-browser
5+
36
# Global
4-
packages/flagging @Datadog/feature-flagging-experimentation
5-
packages/rum/src/domain/record @Datadog/rum-browser @Datadog/session-replay-sdk
6-
packages/rum/src/domain/segmentCollection @Datadog/rum-browser @Datadog/session-replay-sdk
7-
packages/rum/src/domain/*.ts @Datadog/rum-browser @Datadog/session-replay-sdk
8-
* @Datadog/rum-browser
7+
packages/flagging @Datadog/feature-flagging-experimentation
8+
packages/rum/src/domain/record/** @Datadog/rum-browser @Datadog/session-replay-sdk
9+
packages/rum/src/domain/segmentCollection/** @Datadog/rum-browser @Datadog/session-replay-sdk
10+
packages/rum/src/domain/*.ts @Datadog/rum-browser @Datadog/session-replay-sdk
911

1012
# Docs
1113
*README.md @Datadog/rum-browser @DataDog/documentation

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
CURRENT_STAGING: staging-50
2+
CURRENT_STAGING: staging-51
33
APP: 'browser-sdk'
44
CURRENT_CI_IMAGE: 94
55
BUILD_STABLE_REGISTRY: 'registry.ddbuild.io'

packages/rum-core/src/boot/rumPublicApi.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const noopStartRum = (): ReturnType<StartRum> => ({
2323
getInternalContext: () => undefined,
2424
lifeCycle: {} as any,
2525
viewHistory: {} as any,
26+
longTaskContexts: {} as any,
2627
session: {} as any,
2728
stopSession: () => undefined,
2829
startDurationVital: () => ({}) as DurationVitalReference,

packages/rum-core/src/boot/rumPublicApi.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import { createCustomVitalsState } from '../domain/vital/vitalCollection'
5252
import { callPluginsMethod } from '../domain/plugins'
5353
import type { Hooks } from '../domain/hooks'
5454
import type { SdkName } from '../domain/contexts/defaultContext'
55+
import type { LongTaskContexts } from '../domain/longTask/longTaskCollection'
5556
import { createPreStartStrategy } from './preStartRum'
5657
import type { StartRum, StartRumResult } from './startRum'
5758

@@ -484,6 +485,7 @@ export interface ProfilerApi {
484485
configuration: RumConfiguration,
485486
sessionManager: RumSessionManager,
486487
viewHistory: ViewHistory,
488+
longTaskContexts: LongTaskContexts,
487489
createEncoder: (streamId: DeflateEncoderStreamId) => Encoder
488490
) => void
489491
}
@@ -576,6 +578,7 @@ export function makeRumPublicApi(
576578
configuration,
577579
startRumResult.session,
578580
startRumResult.viewHistory,
581+
startRumResult.longTaskContexts,
579582
createEncoder
580583
)
581584

packages/rum-core/src/boot/startRum.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ import { startDisplayContext } from '../domain/contexts/displayContext'
4343
import type { CustomVitalsState } from '../domain/vital/vitalCollection'
4444
import { startVitalCollection } from '../domain/vital/vitalCollection'
4545
import { startCiVisibilityContext } from '../domain/contexts/ciVisibilityContext'
46-
import { startLongAnimationFrameCollection } from '../domain/longAnimationFrame/longAnimationFrameCollection'
47-
import { RumPerformanceEntryType, supportPerformanceTimingEvent } from '../browser/performanceObservable'
4846
import { startLongTaskCollection } from '../domain/longTask/longTaskCollection'
4947
import { startSyntheticsContext } from '../domain/contexts/syntheticsContext'
5048
import { startRumAssembly } from '../domain/assembly'
@@ -237,14 +235,8 @@ export function startRumEventCollection(
237235
const { stop: stopResourceCollection } = startResourceCollection(lifeCycle, configuration, pageStateHistory)
238236
cleanupTasks.push(stopResourceCollection)
239237

240-
if (configuration.trackLongTasks) {
241-
if (supportPerformanceTimingEvent(RumPerformanceEntryType.LONG_ANIMATION_FRAME)) {
242-
const { stop: stopLongAnimationFrameCollection } = startLongAnimationFrameCollection(lifeCycle, configuration)
243-
cleanupTasks.push(stopLongAnimationFrameCollection)
244-
} else {
245-
startLongTaskCollection(lifeCycle, configuration)
246-
}
247-
}
238+
const { stop: stopLongTaskCollection, longTaskContexts } = startLongTaskCollection(lifeCycle, configuration)
239+
cleanupTasks.push(stopLongTaskCollection)
248240

249241
const { addError } = startErrorCollection(lifeCycle, configuration, bufferedDataObservable)
250242

@@ -280,6 +272,7 @@ export function startRumEventCollection(
280272
globalContext,
281273
userContext,
282274
accountContext,
275+
longTaskContexts,
283276
stop: () => cleanupTasks.forEach((task) => task()),
284277
}
285278
}

packages/rum-core/src/domain/action/trackClickActions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ export function trackClickActions(
125125
const rageClick = click.clone()
126126
currentClickChain = createClickChain(click, (clicks) => {
127127
finalizeClicks(clicks, rageClick)
128+
// Clear the reference to allow garbage collection. Without this, the finalize callback
129+
// retains a closure reference to the old click chain, preventing it from being cleaned up
130+
// and causing a memory leak as click chains accumulate over time.
131+
currentClickChain = undefined
128132
})
129133
}
130134
}

packages/rum-core/src/domain/longAnimationFrame/longAnimationFrameCollection.spec.ts

Lines changed: 0 additions & 78 deletions
This file was deleted.

packages/rum-core/src/domain/longAnimationFrame/longAnimationFrameCollection.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)