Skip to content

Commit a2a4c88

Browse files
committed
✨ Add betaEnableViewUpdates config option
1 parent ec19de9 commit a2a4c88

7 files changed

Lines changed: 131 additions & 78 deletions

File tree

package.json

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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ export type TelemetryConfigurationEvent = CommonTelemetryProperties & {
482482
* Whether the beta encode cookie options is enabled
483483
*/
484484
beta_encode_cookie_options?: boolean
485+
/**
486+
* Whether the beta partial view updates feature is enabled
487+
*/
488+
beta_enable_view_updates?: boolean
485489
[k: string]: unknown
486490
}
487491
[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: 104 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,15 @@ export type RumErrorEvent = CommonProperties &
513513
* Profiling context
514514
*/
515515
profiling?: ProfilingInternalContextSchema
516+
/**
517+
* Mapping of source file URLs to their debug IDs for source map deobfuscation
518+
*/
519+
readonly debug_ids?: {
520+
/**
521+
* Debug ID (UUID) for the source file
522+
*/
523+
[k: string]: string
524+
}
516525
[k: string]: unknown
517526
}
518527
[k: string]: unknown
@@ -637,6 +646,15 @@ export type RumLongTaskEvent = CommonProperties &
637646
* Profiling context
638647
*/
639648
profiling?: ProfilingInternalContextSchema
649+
/**
650+
* Mapping of source file URLs to their debug IDs for source map deobfuscation
651+
*/
652+
readonly debug_ids?: {
653+
/**
654+
* Debug ID (UUID) for the source file
655+
*/
656+
[k: string]: string
657+
}
640658
[k: string]: unknown
641659
}
642660
[k: string]: unknown
@@ -919,70 +937,7 @@ export type RumViewEvent = CommonProperties &
919937
}
920938
[k: string]: unknown
921939
}
922-
/**
923-
* Internal properties
924-
*/
925940
readonly _dd: {
926-
/**
927-
* Version of the update of the view event
928-
*/
929-
readonly document_version: number
930-
/**
931-
* List of the page states during the view
932-
*/
933-
readonly page_states?: {
934-
/**
935-
* Page state name
936-
*/
937-
readonly state: 'active' | 'passive' | 'hidden' | 'frozen' | 'terminated'
938-
/**
939-
* Duration in ns between start of the view and start of the page state
940-
*/
941-
readonly start: number
942-
[k: string]: unknown
943-
}[]
944-
/**
945-
* Debug metadata for Replay Sessions
946-
*/
947-
replay_stats?: {
948-
/**
949-
* The number of records produced during this view lifetime
950-
*/
951-
records_count?: number
952-
/**
953-
* The number of segments sent during this view lifetime
954-
*/
955-
segments_count?: number
956-
/**
957-
* The total size in bytes of the segments sent during this view lifetime
958-
*/
959-
segments_total_raw_size?: number
960-
[k: string]: unknown
961-
}
962-
/**
963-
* Additional information of the reported Cumulative Layout Shift
964-
*/
965-
readonly cls?: {
966-
/**
967-
* Pixel ratio of the device where the layout shift was reported
968-
*/
969-
readonly device_pixel_ratio?: number
970-
[k: string]: unknown
971-
}
972-
/**
973-
* Subset of the SDK configuration options in use during its execution
974-
*/
975-
readonly configuration?: {
976-
/**
977-
* Whether session replay recording configured to start manually
978-
*/
979-
readonly start_session_replay_recording_manually?: boolean
980-
[k: string]: unknown
981-
}
982-
/**
983-
* Profiling context
984-
*/
985-
profiling?: ProfilingInternalContextSchema
986941
[k: string]: unknown
987942
}
988943
[k: string]: unknown
@@ -998,16 +953,6 @@ export type RumViewUpdateEvent = ViewContainerSchema &
998953
* RUM event type
999954
*/
1000955
readonly type: 'view_update'
1001-
/**
1002-
* Internal properties
1003-
*/
1004-
readonly _dd?: {
1005-
/**
1006-
* Version of the update of the view event
1007-
*/
1008-
readonly document_version: number
1009-
[k: string]: unknown
1010-
}
1011956
[k: string]: unknown
1012957
}
1013958
export type RumVitalEvent = RumVitalDurationEvent | RumVitalOperationStepEvent
@@ -1657,6 +1602,26 @@ export interface ProfilingInternalContextSchema {
16571602
| 'failed-to-lazy-load'
16581603
| 'missing-document-policy-header'
16591604
| 'unexpected-exception'
1605+
/**
1606+
* The reason provided by the profiling quota admission API. This attribute is only present if the status is `stopped` due to quota.
1607+
*
1608+
* Possible values:
1609+
* - `quota_ok`: Quota check passed.
1610+
* - `quota_exceeded`: The organization has exceeded its profiling quota.
1611+
* - `org_disabled`: The organization has profiling disabled.
1612+
* - `backend_unavailable`: The quota admission API is unavailable or not initialized.
1613+
* - `undefined`: The quota reason is undefined.
1614+
* - `timeout`: The quota check timed out on the client side.
1615+
* - `api-error`: An API error occurred on the client side.
1616+
*/
1617+
readonly quota_reason?:
1618+
| 'quota_ok'
1619+
| 'quota_exceeded'
1620+
| 'org_disabled'
1621+
| 'backend_unavailable'
1622+
| 'undefined'
1623+
| 'timeout'
1624+
| 'api-error'
16601625
[k: string]: unknown
16611626
}
16621627
/**
@@ -2045,6 +2010,72 @@ export interface ViewProperties {
20452010
}
20462011
[k: string]: unknown
20472012
}
2013+
/**
2014+
* Internal properties
2015+
*/
2016+
readonly _dd?: {
2017+
/**
2018+
* Version of the update of the view event
2019+
*/
2020+
readonly document_version: number
2021+
/**
2022+
* List of the page states during the view
2023+
*/
2024+
readonly page_states?: {
2025+
/**
2026+
* Page state name
2027+
*/
2028+
readonly state: 'active' | 'passive' | 'hidden' | 'frozen' | 'terminated'
2029+
/**
2030+
* Duration in ns between start of the view and start of the page state
2031+
*/
2032+
readonly start: number
2033+
[k: string]: unknown
2034+
}[]
2035+
/**
2036+
* Debug metadata for Replay Sessions
2037+
*/
2038+
replay_stats?: {
2039+
/**
2040+
* The number of records produced during this view lifetime
2041+
*/
2042+
records_count?: number
2043+
/**
2044+
* The number of segments sent during this view lifetime
2045+
*/
2046+
segments_count?: number
2047+
/**
2048+
* The total size in bytes of the segments sent during this view lifetime
2049+
*/
2050+
segments_total_raw_size?: number
2051+
[k: string]: unknown
2052+
}
2053+
/**
2054+
* Additional information of the reported Cumulative Layout Shift
2055+
*/
2056+
readonly cls?: {
2057+
/**
2058+
* Pixel ratio of the device where the layout shift was reported
2059+
*/
2060+
readonly device_pixel_ratio?: number
2061+
[k: string]: unknown
2062+
}
2063+
/**
2064+
* Subset of the SDK configuration options in use during its execution
2065+
*/
2066+
readonly configuration?: {
2067+
/**
2068+
* Whether session replay recording configured to start manually
2069+
*/
2070+
readonly start_session_replay_recording_manually?: boolean
2071+
[k: string]: unknown
2072+
}
2073+
/**
2074+
* Profiling context
2075+
*/
2076+
profiling?: ProfilingInternalContextSchema
2077+
[k: string]: unknown
2078+
}
20482079
[k: string]: unknown
20492080
}
20502081
/**

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,10 @@ __metadata:
601601
languageName: unknown
602602
linkType: soft
603603

604-
"@datadog/rum-events-format@DataDog/rum-events-format#commit=02c94b31a2676458a156ed627f3edcd87254beb7":
604+
"@datadog/rum-events-format@DataDog/rum-events-format#commit=bfe6bd954f5ac9f481598e19504a3548ccb2100d":
605605
version: 0.0.0
606-
resolution: "@datadog/rum-events-format@https://github.com/DataDog/rum-events-format.git#commit=02c94b31a2676458a156ed627f3edcd87254beb7"
607-
checksum: 10c0/4a14c1afb23b3e4a0f631f8a1f077d6abab913c82f1145e1585002b488038b00ed19ce16c8840c20c7d94e5d113bc43c48bbb69f46038533cd53d3ebbcbc74c5
606+
resolution: "@datadog/rum-events-format@https://github.com/DataDog/rum-events-format.git#commit=bfe6bd954f5ac9f481598e19504a3548ccb2100d"
607+
checksum: 10c0/a7b3ac3fbdd4743b55c27e75cd073520fea1616a4e5a1c28372576b93afd4742aa02492e37ef6019f019d7dd23f7f3b1c6f18c0c92bace4afc70192455062f25
608608
languageName: node
609609
linkType: hard
610610

@@ -3930,7 +3930,7 @@ __metadata:
39303930
version: 0.0.0-use.local
39313931
resolution: "browser-sdk@workspace:."
39323932
dependencies:
3933-
"@datadog/rum-events-format": "DataDog/rum-events-format#commit=02c94b31a2676458a156ed627f3edcd87254beb7"
3933+
"@datadog/rum-events-format": "DataDog/rum-events-format#commit=bfe6bd954f5ac9f481598e19504a3548ccb2100d"
39343934
"@eslint/js": "npm:10.0.1"
39353935
"@jsdevtools/coverage-istanbul-loader": "npm:3.0.5"
39363936
"@microsoft/api-extractor": "npm:7.58.9"

0 commit comments

Comments
 (0)