Repository navigation
✨ [DEBUG-6251] Add a point-in-time RUM action on the first hit of EXIT probes - #5122
Merged
Merged
Conversation
…T probes Probes evaluated at function exit previously didn't create a RUM custom action, because the RUM API can't backdate the start of an action once the EXIT condition is known. For now, the first qualifying hit of an EXIT probe adds a point-in-time action at the function exit with DD_RUM.addAction(), with the same name and context (probe, snapshot ID, outcome and error type) as ENTRY probe actions. Environment: Datadog workspace Co-Authored-By: Claude Code Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Code Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis 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. |
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 1 Pipeline job failed
ℹ️ InfoNo other issues found (see more)🧪 All tests passed 🎯 Code Coverage (details) Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 8661004 | Docs | View more details | Give us feedback! |
Bundles Sizes Evolution
|
clreaume
approved these changes
Oct 8, 2026
tylfin
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
DEBUG-6251: follow-up to #5107, which only created RUM custom actions for probes evaluated at function entry. EXIT probes were skipped because their condition is only known at exit, and the public RUM API can't backdate the start of an action. For now, EXIT probes get a point-in-time action at the function exit, so we can still find the RUM sessions in which they fired.
Changes
The first qualifying hit of an EXIT probe (one that passes sampling and its exit condition) now calls
DD_RUM.addAction()at function exit:onEntry ENTRY probe → startAction(name, { actionKey: snapshotId, context: { probe, snapshot } }) onReturn / onThrow ENTRY probe → stopAction(name, { actionKey: snapshotId, context: { outcome, error } }) + EXIT probe, after the exit condition passes + → addAction(name, { debugger: { probe, snapshot, outcome, error } }) queue snapshot (reuses the action's snapshot id)probe: <method> (<file>)) and the same final context as ENTRY probe actions, and the snapshot sent for that hit reuses the action's snapshot id.DD_RUMis on the page,trackProbeHitsAsRumActions: falsedisables it, and RUM API failures can't break the instrumented function or prevent the snapshot.trackProbeHitsAsRumActionsJSDoc updated.Worth a reviewer's eye (AI-assisted implementation):
addActionevents have noaction.loading_timeat all, rather thanloading_time: 0. CallingstartAction/stopActionback to back would instead record a meaningless sub-millisecond duration.addActionruns, after the exit condition, message and capture expressions are evaluated (bounded by the existing 10ms capture deadline). The snapshot's timestamp is taken just before the condition, so the two can differ slightly.startAction/stopActionin ✨ [DEBUG-6251] Start a RUM action on the first hit of each browser probe #5107, the publicaddActionrecordsadd-actionusage telemetry. Avoiding that, and supporting real EXIT-probe durations, still needs an internal RUM API designed with the RUM team.Test instructions
yarn test:unit --spec 'packages/browser-debugger/src/**/*.spec.ts'. The oldshould not start an action for EXIT probestest is replaced by aRUM actions > for EXIT probessuite inapi.spec.ts.yarn test:e2e test/e2e/scenario/debugger.scenario.ts -g "RUM action on the first hit". The newadd a point-in-time RUM action on the first hit of an EXIT probescenario calls an instrumented function twice with an EXIT probe, then checks that exactly one custom action is sent, with noloading_time, the matching snapshot id andoutcome: 'return'.@action.type:custom @context.debugger.probe.id:<probe id>.Locally: 883/883
browser-debuggerunit tests pass, and both RUM action E2E scenarios (ENTRY and EXIT) pass on Chromium.Checklist
🤖 Generated with Claude Code