Repository navigation
✨ [DEBUG-6444] Capture Exception Replay snapshots for RUM errors - #5196
gh-worker-dd-mergequeue-cf854d[bot] merged 22 commits into
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 04feaab | Docs | View more details | Give us feedback! |
Bundles Sizes Evolution
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Exception Replay can attach arguments to unrelated async stack frames, omit valid captures, and upload sensitive symbol-property values without redaction. Serialization failures and retries of previously dropped errors can also bypass capture limits.
🤖 Bits Code Review · Commit d17501a
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d17501a1aa
ℹ️ 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".
There was a problem hiding this comment.
Snapshot links can point to the wrong frame in single-line async bundles or to nonexistent frames when a thrown plain object is reported through RUM. Both defects have localized fixes.
🤖 Bits Code Review · Commit 5baae08
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8db607da74
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cbf27e05e
ℹ️ 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".
There was a problem hiding this comment.
Exception Replay can retain arguments captured while effective RUM consent is denied and send them when the same Error is reported after consent is granted. Anonymous async catches can also attach snapshots to unrelated stack frames.
🤖 Bits Code Review · Commit f72c087
💡 Codex Reviewbrowser-sdk/packages/browser-rum-core/src/boot/preStartRum.ts Lines 319 to 320 in f72c087 issue: When a plugin supplied to browser-sdk/packages/browser-rum-core/src/boot/preStartRum.ts Lines 253 to 256 in f72c087 issue: When an added plugin's ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfa04bba24
ℹ️ 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".
|
Note 🤖 Claude Opus 5.5 responding on behalf of Thomas Watson Replying to the Codex review above: both findings are fixed in #5220 (26f1779) and merged here in aa5ab4d.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df1a3640ac
ℹ️ 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".
4d7f7cc to
c1df8a8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1df8a82d1
ℹ️ 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".
A function without callers was matched to a frame of the same script that came earlier in the file whenever one of the two had no function name. An anonymous function that caught an error created by a named function of the same script was then linked to that function's frame. A frame with a name and one without are now from different functions. Two unnamed functions of the same script can still be mistaken for each other. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ption Replay spec The async callee spec failed on Chrome 80 and Edge 80 on BrowserStack. V8 8.0 only adds async frames to a stack when the function resumed from an `await` that fulfilled. V8 8.1 (Chrome 81) also handles an `await` that rejected. `asyncCaller` resumes from a rejected `await`, so on Chromium 80 its stack has no callers and it gets no snapshot. The probe resumed from a fulfilled `await`, so it still reported that the browser shows the caller. Resume the probe from a rejected `await`, like the scenario it guards. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…urns DISCARDED The `eventCollected` hook reused the assemble hooks' `Hook` type. Its `register()` accepted callbacks that return `DISCARDED`, and `trigger()` stopped at the first one, while RUM still sent the event. A plugin registered after one that returned `DISCARDED` never saw the event. For Exception Replay, the error event would link to snapshots that were never sent. Give the hook its own type, backed by an `Observable`, that calls every callback and ignores what they return. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…frame matching
After an `await`, Chrome shows an anonymous async caller as `at async
<url>:line:col`, which `computeStackTrace` parses as a function named
`async`. `ASYNC_FRAME_PREFIX` required a space or `*` after `async`, so
that frame wasn't treated as an async frame, and its `await` column was
compared against the call's column in the error's stack. The function it
called then got no snapshot, as in an `async () => { await f() }`
callback.
Unit tests now run with Vitest, where the spec's own test callback is
such an anonymous async caller, which surfaced this in the "awaiting a
callee that throws before its first await" spec.
Environment: Datadog workspace
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y frame Only the first frame of an exception checked whether RUM tracks the session. Frames captured later, as the exception propagated or was rethrown after tracking consent was withdrawn, were still captured. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Once RUM started, Exception Replay only checked that RUM had a session. The event bridge's session stub stays tracked when tracking consent is withdrawn, so WebViews kept capturing. Consent is now checked too. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…frames A function with callers was matched to an error stack frame by URL and callers only. Two functions called from the same call site have the same callers, so a snapshot could be linked to the frame of another function in the same script. Their names now have to match when both frames have one. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cking The event bridge's session stays tracked when tracking consent is withdrawn, so RUM can still report an error captured before. Its snapshots, which the debugger transport sends over HTTP rather than through the bridge, were still linked and sent. When RUM assembles or collects the error event while tracking is off, the error's captures are now discarded, so they're never sent, even if the error is reported again once tracking resumes. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…R head DataDog/rum-events-format#458 now includes master, so the generated types match both its Exception Replay fields and the newer master fields main uses. The regenerated types are unchanged. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57ef0b1 to
04c70a0
Compare
…Replay frame Capturing a frame reads its arguments and `this`, whose getters can run instrumented code. If that code threw, $dd_catch re-entered before the current frame was stored or its time charged, so nested captures could get past the three-frame limit and charge overlapping time to the capture budget. Such exceptions come from the capture itself, so $dd_catch now ignores them. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Exception Replay can recursively capture a reused error through an instrumented getter, bypassing its frame and time limits and potentially exhausting the stack.
🤖 Bits Code Review · Commit 04c70a0
There was a problem hiding this comment.
More details
Exception Replay captures function arguments and receivers for RUM errors, redacts sensitive names, limits capture work, and sends snapshots only after RUM filtering. The new reentrancy guard fixes the previously reported getter recursion and resets in finally; no findings remain open.
🤖 Bits Code Review · Commit 950b92d
… merge commit DataDog/rum-events-format#458 is merged. The regenerated types are unchanged. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its only consumer, the Exception Replay plugin, reads the event type and domain context only. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in Use ⏳ Building merge commit 5a6586c41d in pipeline 6285655970943912769... |
Motivation
DEBUG-6444
Exception Replay shows the arguments a function had when an error passed through it, on the error's stack frames in Error Tracking. Backend errors get it from the tracers, but browser errors have nothing like it. This brings it to browser errors reported by RUM, using the Live Debugger's build-time instrumentation. This first version captures arguments and
thisonly, not local variables.Changes
exceptionReplayoption calls$dd_catchfor every exception that leaves an instrumented function. The SDK captures the arguments andthisof the three innermost frames as the exception is thrown, and keeps them with the error in aWeakMap. Errors that RUM never reports are garbage collected with their captures, and nothing is sent for them.DD_DEBUGGER.init()adds a RUM plugin to the RUM Browser SDK withDD_RUM.addPlugin()(✨ [DEBUG-6444] Let SDKs add RUM plugins after init with addPlugin() #5220), once RUM has loaded, so customers don't change their RUM configuration, and the Live Debugger SDK can load after RUM is initialized. The plugin addserror.debug_info_captured: "true"and_dd.exception_replay(the exception ID, plus the stack index and snapshot ID of each captured frame) to the RUM error event while it's assembled. Each snapshot carriesexceptionId, so the UI treats it as an Exception Replay snapshot.beforeSendand the event rate limits. An error that either of them drops sends no snapshots, and doesn't start the one-hour limit for its fingerprint.RumPluginOnInitOptions.registerEventCollectedHookregisters a callback that runs once an event has passedbeforeSendand the rate limits, right before it's sent. It's backed by a neweventCollectedhook inhooks.ts, triggered inassembly.ts. A newisTrackingConsentGranted()option tells plugins whether tracking consent is granted, including consent set withsetTrackingConsent()beforeinit(). Exception Replay only captures while it is granted, and after RUM starts, also only while RUM tracks the session. It checks both before each frame, because consent can be withdrawn while an exception propagates, and the event bridge's session stays tracked after consent is withdrawn. An error that RUM reports while either is false has its captures discarded, so they're never sent. With an older RUM SDK that lacks either option oraddPlugin(), Exception Replay warns and stays off.error.stackby lining up the call stack taken inside$dd_catchwith the error's stack, as parsed bycomputeStackTrace. When both frames have a function name, the names must match, as two functions called from the same call site have the same callers. Error Tracking attaches snapshots to frames by that position.maxSnapshotsPerSecondGlobally, so neither feature can use up the other's. Exceptions thrown while a frame is captured, such as by a getter on an argument that runs instrumented code, are ignored.exceptionReplay, and initialize both the RUM Browser SDK and the Live Debugger SDK.$dd_catchis only defined once RUM has initialized the plugin and the Live Debugger SDK is initialized. Nothing is captured in sessions that RUM doesn't track.browser-debugger. Specs check at compile time that it's still assignable toRumPlugin, and that the RUM public API still has theonReady()andaddPlugin()it uses.browser-rum-coreis only a devDependency, because declaring it as a dependency brokeyarn build:apps.This change was written with an AI agent. Please look closely at the frame-index matching in
exceptionReplay.ts, the RUM plugin's types, and the neweventCollectedhook, which the RUM team should review.Schema:
@datadog/rum-events-formatis pinned to the merge commit of DataDog/rum-events-format#458, which adds the new fields.Builds on #5220, now merged, which adds
addPlugin().Test instructions
yarn test:unit --spec packages/browser-debugger/src/domain/exceptionReplay.spec.ts. The plugin, redaction and capture specs sit next to it.yarn test:e2e -g "Exception Replay". One test checks the snapshots are linked to the RUM error event, the other that an error dropped bybeforeSendsends none. The test page uses hand-written code equivalent to what the build plugin generates, so it doesn't need a build-plugins release. Both pass in Chromium, Firefox and WebKit.Checklist
Related PRs
exceptionReplaybuild option that adds the$dd_catchcall.addPlugin()RUM API, which the SDK uses to add its RUM plugin. Merge before the SDK PR.addPlugin(), with the schema bump. (this PR)Reviewed with sol-loop: 4 rounds with gpt-6.2-sol on xhigh. Sol verdict: approved
Created with Claude Opus 5.5 and Claude Sonnet 5.5 in Claude Code.