Skip to content

✨ Add browser debugger Capture Expressions#4731

Open
watson wants to merge 1 commit into
mainfrom
watson/DEBUG-5733/support-capture-expressions
Open

✨ Add browser debugger Capture Expressions#4731
watson wants to merge 1 commit into
mainfrom
watson/DEBUG-5733/support-capture-expressions

Conversation

@watson
Copy link
Copy Markdown
Collaborator

@watson watson commented Jun 5, 2026

Motivation

Add Capture Expressions support to the browser debugger so method probes can capture named expression results without enabling full snapshot capture.

Changes

  • Add captureExpressions probe parsing/compilation for browser debugger probes.
  • Evaluate Capture Expressions at the configured method phase (ENTRY or EXIT) and serialize them under captures.entry.captureExpressions or captures.return.captureExpressions.
  • Treat Capture Expression probes as snapshot-producing for sampling, global limits, stack capture, and lifetime budgets.
  • Reject Delivery API probes that combine captureSnapshot with captureExpressions.
  • Add a shared mergeArrays utility in browser-core for optional array merging.
  • Add unit coverage for compilation, invalid expressions, delivery filtering, entry/return/throw evaluation, evaluation errors, limits, and rate limiting.

Test instructions

  • yarn test:unit --spec packages/browser-core/src/tools/utils/arrayUtils.spec.ts --spec packages/browser-debugger/src/domain/template.spec.ts --spec packages/browser-debugger/src/domain/probes.spec.ts --spec packages/browser-debugger/src/domain/api.spec.ts --spec packages/browser-debugger/src/domain/deliveryApi.spec.ts
  • yarn typecheck

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

Copy link
Copy Markdown
Collaborator Author

watson commented Jun 5, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented Jun 5, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 171.86 KiB 171.86 KiB 0 B 0.00%
Rum Profiler 7.88 KiB 7.88 KiB 0 B 0.00%
Rum Recorder 21.21 KiB 21.21 KiB 0 B 0.00%
Logs 54.31 KiB 54.31 KiB 0 B 0.00%
Rum Slim 129.69 KiB 129.69 KiB 0 B 0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%

@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 Bot commented Jun 5, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 80.26%
Overall Coverage: 76.75% (+0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7cdb1b5 | Docs | Datadog PR Page | Give us feedback!

@watson watson force-pushed the watson/DEBUG-5733/support-capture-expressions branch from 9f382d9 to 8abb9af Compare June 5, 2026 10:03
@watson watson force-pushed the watson/DEBUG-5733/refactor-template-cache branch from 0edbca8 to 90a1c84 Compare June 5, 2026 10:03
@watson watson force-pushed the watson/DEBUG-5733/support-capture-expressions branch from 8abb9af to 6cce48e Compare June 5, 2026 11:02
@watson watson force-pushed the watson/DEBUG-5733/refactor-template-cache branch from 90a1c84 to 284e2b3 Compare June 5, 2026 11:02
@watson watson force-pushed the watson/DEBUG-5733/support-capture-expressions branch from 6cce48e to 5c76cd2 Compare June 5, 2026 12:33
Base automatically changed from watson/DEBUG-5733/refactor-template-cache to main June 5, 2026 13:17
Support Capture Expressions on browser debugger method probes so users can
capture named expression results without collecting full snapshots.

Expressions are compiled at probe initialization, evaluated at the configured
ENTRY or EXIT phase, and serialized under the matching entry/return capture.
They use snapshot budgets and are rejected when combined with full snapshots.

Add focused tests for compilation, delivery filtering, evaluation errors,
capture limits, rate limits, and the shared array merge helper.
@watson watson force-pushed the watson/DEBUG-5733/support-capture-expressions branch from 5c76cd2 to 7cdb1b5 Compare June 5, 2026 14:16
@watson watson marked this pull request as ready for review June 5, 2026 14:17
@watson watson requested review from a team as code owners June 5, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant