Skip to content

Commit 3193dcc

Browse files
committed
✨ Add betaEnableViewUpdates config option
1 parent 8af9fbf commit 3193dcc

8 files changed

Lines changed: 49 additions & 52 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"woke": "scripts/cli woke"
4444
},
4545
"devDependencies": {
46-
"@datadog/rum-events-format": "DataDog/rum-events-format#commit=02c94b31a2676458a156ed627f3edcd87254beb7",
46+
"@datadog/rum-events-format": "DataDog/rum-events-format#commit=c90ea19ee1804c20a37193f938c43559ba92abea",
4747
"@eslint/js": "10.0.1",
4848
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
4949
"@microsoft/api-extractor": "7.58.9",

packages/browser-core/src/domain/telemetry/telemetryEvent.types.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
* Schema of all properties of a telemetry event
77
*/
88
export type TelemetryEvent =
9-
| TelemetryErrorEvent
10-
| TelemetryDebugEvent
11-
| TelemetryConfigurationEvent
12-
| TelemetryUsageEvent
9+
TelemetryErrorEvent | TelemetryDebugEvent | TelemetryConfigurationEvent | TelemetryUsageEvent
1310
/**
1411
* Schema of all properties of a telemetry error event
1512
*/
@@ -482,6 +479,10 @@ export type TelemetryConfigurationEvent = CommonTelemetryProperties & {
482479
* Whether the beta encode cookie options is enabled
483480
*/
484481
beta_encode_cookie_options?: boolean
482+
/**
483+
* Whether the beta partial view updates feature is enabled
484+
*/
485+
beta_enable_view_updates?: boolean
485486
[k: string]: unknown
486487
}
487488
[k: string]: unknown

packages/browser-rum-core/src/boot/preStartRum.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
noop,
1111
getEventBridge,
1212
initFeatureFlags,
13+
addExperimentalFeatures,
14+
ExperimentalFeature,
1315
addTelemetryConfiguration,
1416
CustomerContextKey,
1517
buildAccountContextManager,
@@ -229,6 +231,9 @@ export function createPreStartStrategy(
229231
}
230232
// Set the experimental feature flags as early as possible, so we can use them in most places
231233
initFeatureFlags(initConfiguration.enableExperimentalFeatures)
234+
if (initConfiguration.betaEnableViewUpdates) {
235+
addExperimentalFeatures([ExperimentalFeature.PARTIAL_VIEW_UPDATES])
236+
}
232237
setAllowUntrustedEvents(initConfiguration.allowUntrustedEvents)
233238

234239
// Expose the initial configuration regardless of initialization success.

packages/browser-rum-core/src/domain/configuration/configuration.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ describe('serializeRumConfiguration', () => {
832832
profilingSampleRate: 42,
833833
propagateTraceBaggage: true,
834834
trackResourceHeaders: true,
835+
betaEnableViewUpdates: true,
835836
}
836837

837838
type MapRumInitConfigurationKey<Key extends string> = Key extends keyof InitConfiguration
@@ -887,6 +888,7 @@ describe('serializeRumConfiguration', () => {
887888
use_remote_configuration_proxy: true,
888889
profiling_sample_rate: 42,
889890
track_resource_headers: 'default_headers',
891+
beta_enable_view_updates: true,
890892
})
891893
})
892894
})

packages/browser-rum-core/src/domain/configuration/configuration.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ export interface RumInitConfiguration extends InitConfiguration {
343343
* @category Data Collection
344344
*/
345345
allowedGraphQlUrls?: Array<MatchOption | GraphQlUrlOption> | undefined
346+
347+
/**
348+
* Enable partial view updates, which reduces bandwidth by sending only changed
349+
* fields instead of full view events on intermediate updates.
350+
*
351+
* @category Beta
352+
*/
353+
betaEnableViewUpdates?: boolean | undefined
346354
}
347355

348356
export type HybridInitConfiguration = Omit<RumInitConfiguration, 'applicationId' | 'clientToken'>
@@ -386,6 +394,7 @@ export interface RumConfiguration extends Configuration {
386394
sessionReplaySampleRate: number
387395
startSessionReplayRecordingManually: boolean
388396
trackUserInteractions: boolean
397+
betaEnableViewUpdates: boolean
389398
trackViewsManually: boolean
390399
trackResources: boolean
391400
trackResourceHeaders: MatchHeader[]
@@ -457,6 +466,7 @@ export function validateAndBuildRumConfiguration(
457466
workerUrl: initConfiguration.workerUrl,
458467
compressIntakeRequests: !!initConfiguration.compressIntakeRequests,
459468
trackUserInteractions: !!(initConfiguration.trackUserInteractions ?? true),
469+
betaEnableViewUpdates: !!initConfiguration.betaEnableViewUpdates,
460470
trackViewsManually: !!initConfiguration.trackViewsManually,
461471
trackResources: !!(initConfiguration.trackResources ?? true),
462472
trackResourceHeaders: validateAndBuildTrackResourceHeaders(initConfiguration),
@@ -685,6 +695,7 @@ export function serializeRumConfiguration(configuration: RumInitConfiguration) {
685695
profiling_sample_rate: configuration.profilingSampleRate,
686696
use_remote_configuration_proxy: !!configuration.remoteConfigurationProxy,
687697
track_resource_headers: getTrackResourceHeadersTelemetryValue(configuration.trackResourceHeaders),
698+
beta_enable_view_updates: configuration.betaEnableViewUpdates,
688699
...baseSerializedConfiguration,
689700
} satisfies RawTelemetryConfiguration
690701
}

packages/browser-rum-core/src/rumEvent.types.ts

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,7 @@ export type RumActionEvent = CommonProperties &
163163
* The strategy of how the auto click action name is computed
164164
*/
165165
name_source?:
166-
| 'custom_attribute'
167-
| 'mask_placeholder'
168-
| 'standard_attribute'
169-
| 'text_content'
170-
| 'mask_disallowed'
171-
| 'blank'
166+
'custom_attribute' | 'mask_placeholder' | 'standard_attribute' | 'text_content' | 'mask_disallowed' | 'blank'
172167
[k: string]: unknown
173168
}
174169
[k: string]: unknown
@@ -611,12 +606,7 @@ export type RumLongTaskEvent = CommonProperties &
611606
* Type of the invoker of the script
612607
*/
613608
readonly invoker_type?:
614-
| 'user-callback'
615-
| 'event-listener'
616-
| 'resolve-promise'
617-
| 'reject-promise'
618-
| 'classic-script'
619-
| 'module-script'
609+
'user-callback' | 'event-listener' | 'resolve-promise' | 'reject-promise' | 'classic-script' | 'module-script'
620610
/**
621611
* The container (the top-level document, or an <iframe>) the long animation frame occurred in
622612
*/
@@ -663,17 +653,7 @@ export type RumResourceEvent = CommonProperties &
663653
* Resource type
664654
*/
665655
readonly type:
666-
| 'document'
667-
| 'xhr'
668-
| 'beacon'
669-
| 'fetch'
670-
| 'css'
671-
| 'js'
672-
| 'image'
673-
| 'font'
674-
| 'media'
675-
| 'other'
676-
| 'native'
656+
'document' | 'xhr' | 'beacon' | 'fetch' | 'css' | 'js' | 'image' | 'font' | 'media' | 'other' | 'native'
677657
/**
678658
* HTTP method of the resource
679659
*/
@@ -1254,15 +1234,7 @@ export interface CommonProperties {
12541234
* The list of available network interfaces
12551235
*/
12561236
readonly interfaces?: (
1257-
| 'bluetooth'
1258-
| 'cellular'
1259-
| 'ethernet'
1260-
| 'wifi'
1261-
| 'wimax'
1262-
| 'mixed'
1263-
| 'other'
1264-
| 'unknown'
1265-
| 'none'
1237+
'bluetooth' | 'cellular' | 'ethernet' | 'wifi' | 'wimax' | 'mixed' | 'other' | 'unknown' | 'none'
12661238
)[]
12671239
/**
12681240
* Cellular connection type reflecting the measured network performance
@@ -1653,10 +1625,21 @@ export interface ProfilingInternalContextSchema {
16531625
* - `unexpected-exception`: An exception occurred when starting the Profiler.
16541626
*/
16551627
readonly error_reason?:
1656-
| 'not-supported-by-browser'
1657-
| 'failed-to-lazy-load'
1658-
| 'missing-document-policy-header'
1659-
| 'unexpected-exception'
1628+
'not-supported-by-browser' | 'failed-to-lazy-load' | 'missing-document-policy-header' | 'unexpected-exception'
1629+
/**
1630+
* The reason provided by the profiling quota admission API. This attribute is only present if the status is `stopped` due to quota.
1631+
*
1632+
* Possible values:
1633+
* - `quota_ok`: Quota check passed.
1634+
* - `quota_exceeded`: The organization has exceeded its profiling quota.
1635+
* - `org_disabled`: The organization has profiling disabled.
1636+
* - `backend_unavailable`: The quota admission API is unavailable or not initialized.
1637+
* - `undefined`: The quota reason is undefined.
1638+
* - `timeout`: The quota check timed out on the client side.
1639+
* - `api-error`: An API error occurred on the client side.
1640+
*/
1641+
readonly quota_reason?:
1642+
'quota_ok' | 'quota_exceeded' | 'org_disabled' | 'backend_unavailable' | 'undefined' | 'timeout' | 'api-error'
16601643
[k: string]: unknown
16611644
}
16621645
/**

packages/browser-rum/src/types/sessionReplay.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,7 @@ export type AddCDataSectionNodeChange = [InsertionPoint, '#cdata-section' | Stri
138138
* Browser-specific. Schema representing the insertion point of a node which is being added to the document.
139139
*/
140140
export type InsertionPoint =
141-
| AppendChildInsertionPoint
142-
| InsertAfterPreviousInsertionPoint
143-
| InsertBeforeInsertionPoint
144-
| RootInsertionPoint
141+
AppendChildInsertionPoint | InsertAfterPreviousInsertionPoint | InsertBeforeInsertionPoint | RootInsertionPoint
145142
/**
146143
* A positive integer insertion point. Inserting a node at positive integer N indicates that the new node's parent is the node with an id N lower than the new node, and that we should insert the new node at the end of its parent's child list, as if the DOM method appendChild() was being used.
147144
*/
@@ -266,9 +263,7 @@ export type AddStyleSheetChange = StyleSheetSnapshot
266263
* @minItems 1
267264
*/
268265
export type StyleSheetSnapshot =
269-
| [StyleSheetRules]
270-
| [StyleSheetRules, StyleSheetMediaList]
271-
| [StyleSheetRules, StyleSheetMediaList, boolean]
266+
[StyleSheetRules] | [StyleSheetRules, StyleSheetMediaList] | [StyleSheetRules, StyleSheetMediaList, boolean]
272267
/**
273268
* Schema representing a CSS stylesheet's rules, encoded either as a single string or as an array containing a separate string for each rule.
274269
*/

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,10 +599,10 @@ __metadata:
599599
languageName: unknown
600600
linkType: soft
601601

602-
"@datadog/rum-events-format@DataDog/rum-events-format#commit=02c94b31a2676458a156ed627f3edcd87254beb7":
602+
"@datadog/rum-events-format@DataDog/rum-events-format#commit=c90ea19ee1804c20a37193f938c43559ba92abea":
603603
version: 0.0.0
604-
resolution: "@datadog/rum-events-format@https://github.com/DataDog/rum-events-format.git#commit=02c94b31a2676458a156ed627f3edcd87254beb7"
605-
checksum: 10c0/4a14c1afb23b3e4a0f631f8a1f077d6abab913c82f1145e1585002b488038b00ed19ce16c8840c20c7d94e5d113bc43c48bbb69f46038533cd53d3ebbcbc74c5
604+
resolution: "@datadog/rum-events-format@https://github.com/DataDog/rum-events-format.git#commit=c90ea19ee1804c20a37193f938c43559ba92abea"
605+
checksum: 10c0/24cb4527dbdb216687de7378ac04ff28235015fd02a47608012bd055eed7e32e57cc30282922aafb5e37fa7b549902e66396f1fb9e3bd7915cb75a87a08d6411
606606
languageName: node
607607
linkType: hard
608608

@@ -3919,7 +3919,7 @@ __metadata:
39193919
version: 0.0.0-use.local
39203920
resolution: "browser-sdk@workspace:."
39213921
dependencies:
3922-
"@datadog/rum-events-format": "DataDog/rum-events-format#commit=02c94b31a2676458a156ed627f3edcd87254beb7"
3922+
"@datadog/rum-events-format": "DataDog/rum-events-format#commit=c90ea19ee1804c20a37193f938c43559ba92abea"
39233923
"@eslint/js": "npm:10.0.1"
39243924
"@jsdevtools/coverage-istanbul-loader": "npm:3.0.5"
39253925
"@microsoft/api-extractor": "npm:7.58.9"

0 commit comments

Comments
 (0)