Commit 813aee6
feat: add view_update event type (#355)
* feat(rum): add view_update event type and _view-properties shared schema
Implements the view_update event type per the approved RFC on RUM Event
Format limitations. The new event carries only changed view fields,
eliminating the 50-90% redundant data sent with every full view update.
Key changes:
- Add schemas/rum/_view-properties.json: shared optional view-specific
properties (no required fields) composed by both view and view_update
- Add schemas/rum/view_update-schema.json: standalone schema (no
_common-schema.json ref) with minimal required set: type, application.id,
session.id, view.id, _dd.document_version
- Refactor schemas/rum/view-schema.json to reference _view-properties.json,
slimming its last allOf block to type and _dd.document_version only
- Add view_update to oneOf in rum-events-schema.json,
rum-events-browser-schema.json, and rum-events-mobile-schema.json
- Add samples/rum-events/view_update.json sample event
- Regenerate TypeScript types: RumViewUpdateEvent exported in lib/generated/rum.ts
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(rum): align account.id required and rebuild with tsc 5.9.3
Two fixes for failing CI checks:
1. ios-sdk-test: The Swift code generator creates a single shared
RUMAccount struct across all event schemas. view_update had
account.id as optional while all other events (via _common-schema.json)
have it required, causing an inconsistency error. Adding required: ["id"]
to account in view_update-schema.json resolves the conflict.
2. check-is-built: Local node_modules had tsc 4.7.4 (stale, pre-yarn-install)
while yarn.lock pins tsc 5.9.3. The two versions emit different declaration
file syntax (export declare type vs export type), causing the committed
lib/ files to not match CI's build output. Rebuilding with the correct
tsc 5.9.3 after running yarn install fixes the mismatch.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(rum): align view_update shared struct definitions with _common-schema
The iOS Swift code generator requires all uses of a named struct (Session,
View, OS, Device) across event schemas to have identical field definitions.
Four conflicts remained after the previous fix:
- Device.locale/locales/timeZone: descriptions in _common-schema.json use
U+2019 (curly right single quote) while view_update used plain ASCII
apostrophes (U+0027). Fixed by copying the exact characters.
- Session: _common-schema requires both id and type; view_update only
required id. Added type to session.required.
- View: _common-schema requires id and url; view_update only required id.
Added url to view.required and updated the sample accordingly.
- OS: _common-schema requires name, version, version_major; view_update
had no required fields. Added the matching required array.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(rum): apply prettier formatting to view_update files
Python's json.dump produced non-Prettier-compliant formatting in
view_update-schema.json and view_update.json. Running yarn format -w
to fix.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(rum): copy exact device descriptions from _common-schema.json
Previous fix over-replaced ASCII apostrophes with U+2019 in device
descriptions, converting example quote chars around 'en-US' and
'Europe/Berlin' as well. _common-schema.json only uses U+2019 for
possessive apostrophes (user's, device's), not for example quotes.
Copying descriptions verbatim from _common-schema.json to ensure
byte-identical strings and resolve the Swift shared struct conflict.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(rum): address review feedback on view_update schema
- view_update: use _common-schema.json directly; session.type, view.url
and _dd.format_version are required alongside the delta payload
- view_update: make date required; remove required on sub-object fields
(connectivity.status, display.viewport dims, os fields) that block
partial updates
- view-schema: restore required constraints removed by refactor
(view.time_spent, action/error/resource.count, privacy.replay_level,
display.scroll fields)
- view-schema: move view-specific _dd properties (page_states,
replay_stats, cls, configuration, profiling) out of _view-properties
and into view-schema to eliminate _dd namespace collision with
view_update
- sample: update view_update.json to reflect minimal delta payload
* fix: move required constraints into _view-properties.json to avoid Android generator merge conflict
The Android SDK model generator cannot merge Enum with Primitive(type=STRING).
Previously, view-schema.json had typed stubs for privacy.replay_level and
display.scroll.* properties that conflicted with their enum/typed definitions
in _view-properties.json when the Android generator resolved the allOf merge.
Move the required constraints directly into _view-properties.json and remove
the typed property stubs from view-schema.json's inline allOf block. This
eliminates the merge conflict entirely since _view-properties.json is a single
source of truth for these properties.
* fix: replace empty stubs with typed stubs to fix Android generator crash
The Android schema generator does not support empty {} schema definitions
(all-null JsonDefinition). The view-schema.json stubs for time_spent ({})
and action/error/resource ({ required: [count] }) caused the generator to
crash with 'Unsupported schema definition'.
- Replace {} and bare-required stubs with typed stubs ({ type: integer }
and { type: object }) so the generator sees a concrete type to work with
- Move required:[count] for action/error/resource into _view-properties.json
alongside their property definitions, per reviewer suggestion
The outer view.required:[time_spent,action,error,resource] stays in
view-schema.json since view_update uses _view-properties.json and those
fields must remain optional for delta events.
* refactor: remove redundant property type stubs from view-schema.json
* Revert "refactor: remove redundant property type stubs from view-schema.json"
This reverts commit 9fa7961.
* fix required in some places (#360)
* fix build
* rename _view-properties.json to _view-properties-schema.json to match naming convention
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Sasha Gringauz <aleksandr.gringauz@datadoghq.com>1 parent 5622f2a commit 813aee6
9 files changed
Lines changed: 1958 additions & 1795 deletions
File tree
- lib
- cjs/generated
- esm/generated
- samples/rum-events
- schemas
- rum
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
0 commit comments