Skip to content

[RUM-14619] Add AddViewLoadingTime telemetry to browser schema#352

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
mael.lilensten/add-view-loading-time-telemetry
Mar 9, 2026
Merged

[RUM-14619] Add AddViewLoadingTime telemetry to browser schema#352
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
mael.lilensten/add-view-loading-time-telemetry

Conversation

@MaelNamNam
Copy link
Copy Markdown
Contributor

@MaelNamNam MaelNamNam commented Feb 16, 2026

What does this PR do?

Adds AddViewLoadingTime to the shared telemetry features schema (common-features-schema.json), enabling both Browser and Mobile SDKs to track usage of the addViewLoadingTime API.

Why?

The Browser SDK is adding a new setViewLoadingTime({ overwrite }) API for manually reporting view loading times (DataDog/browser-sdk#4180). This schema change enables telemetry tracking aligned with the mobile SDK's existing pattern.

The type is placed in the common schema (not browser-only) because both mobile and browser SDKs share the same addViewLoadingTime API surface and telemetry fields.

Changes

  • Added AddViewLoadingTime entry to schemas/telemetry/usage/common-features-schema.json with:
    • feature: "addViewLoadingTime" (const, required)
    • overwritten: boolean (optional) — whether this call overwrote a previously set loading time
    • no_view: boolean (optional) — API called with no view tracking (mobile only)
    • no_active_view: boolean (optional) — API called when no view is active (mobile only)
  • Removed duplicate AddViewLoadingTime from schemas/telemetry/usage/mobile-features-schema.json (moved to common)
  • Regenerated TypeScript types in lib/cjs/generated/telemetry.d.ts and lib/esm/generated/telemetry.d.ts
  • Added browser and mobile event samples

Why are all fields except feature optional?

  • no_view / no_active_view: The browser SDK always creates a view on init(), so these are mobile-only. The browser omits them entirely rather than sending false.
  • overwritten: The browser SDK does not send this field for now. Mobile SDKs already report it. Kept optional so each SDK can adopt it independently.

Impact

  • Shared across Browser and Mobile SDKs via common schema
  • Additive change — no breaking changes to existing telemetry types
  • After merge: Browser SDK schema sync will replace the manually-added AddViewLoadingTime type in telemetryEvent.types.ts

@MaelNamNam MaelNamNam force-pushed the mael.lilensten/add-view-loading-time-telemetry branch from 9d9df43 to e3ec305 Compare February 16, 2026 21:49
@MaelNamNam MaelNamNam changed the title Simplify AddViewLoadingTime telemetry: overwrite field only Add AddViewLoadingTime telemetry to browser schema Feb 16, 2026
@MaelNamNam MaelNamNam force-pushed the mael.lilensten/add-view-loading-time-telemetry branch from e3ec305 to 394818a Compare February 16, 2026 22:20
@MaelNamNam MaelNamNam changed the title Add AddViewLoadingTime telemetry to browser schema [RUM-14619] Add AddViewLoadingTime telemetry to browser schema Feb 17, 2026
@MaelNamNam MaelNamNam force-pushed the mael.lilensten/add-view-loading-time-telemetry branch from c05a910 to af6039a Compare March 3, 2026 12:25
@MaelNamNam MaelNamNam self-assigned this Mar 3, 2026
@MaelNamNam MaelNamNam force-pushed the mael.lilensten/add-view-loading-time-telemetry branch from af6039a to be67b90 Compare March 3, 2026 23:28
@bcaudan
Copy link
Copy Markdown
Contributor

bcaudan commented Mar 4, 2026

The approach looks good to me however:

  • ❗ warning: the ci is failing, you should ensure to regenerate the types for every update
  • 💬 suggestion: you could add event samples to demonstrate mobile and browser usages‏

@bcaudan
Copy link
Copy Markdown
Contributor

bcaudan commented Mar 4, 2026

💭 thought: ‏Looking at your implementation, I think it could be interesting to introduce an overwrite property, to capture the customer intent and know if this API option is used, independently of if a loading time was actually overwritten.

@MaelNamNam MaelNamNam force-pushed the mael.lilensten/add-view-loading-time-telemetry branch from e2a11df to ae6d7c3 Compare March 5, 2026 21:56
@MaelNamNam
Copy link
Copy Markdown
Contributor Author

The approach looks good to me however:

  • ❗ warning: the ci is failing, you should ensure to regenerate the types for every update
  • 💬 suggestion: you could add event samples to demonstrate mobile and browser usages‏

@bcaudan this is done, thanks

@MaelNamNam
Copy link
Copy Markdown
Contributor Author

💭 thought: ‏Looking at your implementation, I think it could be interesting to introduce an overwrite property, to capture the customer intent and know if this API option is used, independently of if a loading time was actually overwritten.

@bcaudan I feel it's a bit overkill to be completely honest. We didn't have this intent captured in the telemetry coming from our mobile SDKs, so I'd rather keep it simple. It's an experimental feature in our Browser SDK anyway. Do you have a strong opinion here? Or was this more of a idea?

@MaelNamNam MaelNamNam marked this pull request as ready for review March 5, 2026 22:05
@MaelNamNam MaelNamNam requested review from a team as code owners March 5, 2026 22:05
Copy link
Copy Markdown
Contributor

@mormubis mormubis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean move — the schema diff is minimal and the generated types look exactly right. Adding browser and mobile samples is a nice touch for documenting the difference between the two payloads.

Left a couple of inline questions before approving.

Comment thread schemas/telemetry/usage/common-features-schema.json
Comment on lines +324 to +331
"no_view": {
"type": "boolean",
"description": "Whether the view is not available"
},
"no_active_view": {
"type": "boolean",
"description": "Whether the available view is not active"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick alignment check: are these tracking call-site options (what the caller explicitly passed) or runtime state (what the environment looked like at call time)? The browser-sdk guidance says addTelemetryUsage should be for static call-site info only and specifically calls out "whether a view was active" and "whether a value was overwritten" as examples of runtime state that shouldn't go there. If overwrite is an explicit option passed to the API, overwritten is fine — but no_view/no_active_view feel more like environmental state. Worth a quick check with the team to make sure we're aligned.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are mobile-only fields that track environmental state at call time. Indeed, they don't fit the "call-site info only" principle. That said, they already ship in the mobile SDKs and we're just moving them to the common schema for consolidation, while making them optional so the browser SDK can omit them entirely.

I feel changing the mobile behavior would be out of scope here, but let me know 🙇

Comment thread schemas/telemetry/usage/common-features-schema.json Outdated
@bcaudan
Copy link
Copy Markdown
Contributor

bcaudan commented Mar 9, 2026

💭 thought: ‏Looking at your implementation, I think it could be interesting to introduce an overwrite property, to capture the customer intent and know if this API option is used, independently of if a loading time was actually overwritten.

@bcaudan I feel it's a bit overkill to be completely honest.

Yes, it was just a thought, we could do that later if we feel the need.

Comment on lines +316 to +317
"required": ["feature", "overwritten"],
"title": "AddViewLoadingTime",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 suggestion: ‏I think we could set overwritten as optional as well to not implement it on the browser side for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already send overwritten on the browser side, it's mapped from the overwrite API option. That said, it currently reflects customer intent rather than actual runtime state (i.e. we send true if the user passed @
overwrite: true, and even if no loading time was previously set). So I agree that the current implementation isn't the best.

I can:

  1. Make overwritten optional
  2. Change the browser SDK implementation so we trigger the telemetry event with overwritten set to true or false based on the outcome and not the intent
  3. Keep it like this as the browser SDK setViewLoadingTime is experimental

Let me know what you would prefer 🙇

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go with 1 as

  • I don't think we are interested by monitoring overwritten for now on the browser side, so it does not worth the extra bytes
  • it can be confusing to use overwritten to monitor overwrite

If we later feel that we are interested in either overwritten or overwrite on the browse side, we could easily update the schema and the implementation.

Copy link
Copy Markdown
Contributor Author

@MaelNamNam MaelNamNam Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. See commits 1292d02 below and 28e56e6 in the browser SDK PR

@MaelNamNam MaelNamNam requested review from bcaudan and mormubis March 9, 2026 10:16
Copy link
Copy Markdown
Contributor

@bcaudan bcaudan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@mormubis mormubis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous comments all addressed. LGTM.

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 5ddfd3b into master Mar 9, 2026
13 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the mael.lilensten/add-view-loading-time-telemetry branch March 9, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants