Conversation
|
All contributors have signed the CLA ✍️ ✅ |
8698d86 to
7aff300
Compare
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 92c8de9 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Introduce tabContext that generates a UUID v4 per browser tab, persisted in sessionStorage to survive reloads, with an in-memory fallback when storage is unavailable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add _dd.browser_tab_id UUID field to the RUM common schema and the Logs event types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register tabContext in both RUM and Logs event assembly so every event includes _dd.browser_tab_id. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Make retrieveOrCreateTabId internal (not exported) - Rewrite tabContext tests to use public startTabContext API - Add edge case test for sessionStorage.setItem throwing - Add RUM integration test for browser_tab_id in assembly - Remove unrelated INP sub_parts from rumEvent.types.ts - Add TODO comment for browser_tab_id schema sync Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The _dd object already has [k: string]: unknown, so the explicit field is unnecessary. The proper type definition belongs in the upstream rum-events-format schema. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Revert submodule and generated type changes that were unrelated to the tab context feature. The browser_tab_id field flows through _dd's [k: string]: unknown index signature and does not need explicit type definitions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
045cb13 to
e53f2d3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e53f2d3285
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return newId | ||
| } catch { | ||
| // sessionStorage unavailable (e.g. Web Worker, sandboxed iframe, quota exceeded) | ||
| return generateUUID() |
There was a problem hiding this comment.
Reuse fallback tab ID across SDK initializations
When sessionStorage is unavailable, retrieveOrCreateTabId() returns a fresh UUID on every call. Since both startRumEventCollection() and startLogs() call startTabContext(), pages that initialize both SDKs in environments where storage throws (for example sandboxed iframes or restricted privacy modes) will emit different _dd.browser_tab_id values for RUM vs Logs from the same tab, breaking tab-level correlation. The fallback path should cache one in-memory ID per page lifecycle instead of regenerating it per initialization.
Useful? React with 👍 / 👎.
| readonly presentation_delay: number | ||
| [k: string]: unknown | ||
| } | ||
| [k: string]: unknown |
There was a problem hiding this comment.
Keep INP sub_parts in exported RUM event typings
This deletion removes view.performance.inp.sub_parts from the public RumEvent type, but INP sub-parts are still produced at runtime in viewCollection (sub_parts is assigned when INP subparts exist). That creates a TypeScript API regression: consumers that previously read inp.sub_parts now get type errors even though the SDK still sends the field. The generated type should remain aligned with emitted payloads (including the correct processing_duration key).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The new field should be added in rum-events-format
Motivation
The Browser SDK shares session state across tabs via cookies/localStorage, but has no way to identify which specific tab produced a given event. Adding
tab.idenables distinguishing events from different tabs within the same session, enabling tab-level correlation between RUM and Logs.Changes
tabContextmodule (packages/core/src/domain/contexts/tabContext.ts): Generates a UUID v4 per browser tab, persisted insessionStorageso it survives same-tab navigations and reloads. Falls back to an in-memory UUID (cached at module level) whensessionStorageis unavailable (Web Workers, sandboxed iframes, quota exceeded), ensuring RUM and Logs always share the sametab.idwithin a page lifecycle.startTabContext(hooks)which registers anAssemblehook contributing{ tab: { id: "<uuid>" } }to every event.getItemthrows,setItemthrows).Field placement
tab.idsits at the top level alongsideview,session,usr, etc. — it has a different lifecycle than a view (a single tab spans multiple views via SPA navigation) and is customer-facing, unlike the_ddinternal namespace.Behavior
sessionStoragesessionStoragesessionStorageunavailablesessionStorage-based schemes)Test instructions
Manual verification (sandbox):
yarn dev→ openhttp://localhost:8080in two separate tabsChecklist