Open
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: c43480d | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
4df303f to
b539c14
Compare
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
Collaborator
Author
|
I have read the CLA Document and I hereby sign the CLA |
9805f3b to
3042bfe
Compare
Introduce the browser debugger SDK and probe execution pipeline so browser code can evaluate conditions, capture snapshots, and render probe messages at runtime. Add Delivery API polling plus sandbox and performance tooling to support probe delivery and testing.
3042bfe to
98490f7
Compare
4 tasks
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98490f775f
ℹ️ 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".
4 tasks
4 tasks
4 tasks
4 tasks
Validate that the expression compiler and template segment compiler only produce JavaScript syntax supported by the oldest target browser (Chrome 63 / ES2017). Since these code strings are evaluated at runtime via new Function() and bypass TypeScript/webpack transpilation, modern syntax like optional chaining or optional catch binding slips through undetected. Parsing the compiled output with acorn at ecmaVersion 2017 catches these issues in unit tests before they reach BrowserStack.
4 tasks
4 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Introduce the
@datadog/browser-debuggerpackage to enable Live Debugger in browser applications. This gives frontend developers the ability to add log probes to running applications, evaluate conditions, and inspect runtime state — all without redeploying or modifying source code.Changes
New package:
packages/debuggerA new
@datadog/browser-debuggerpackage that provides the full probe execution pipeline:domain/api.ts— Core instrumentation hooks (onEntry,onReturn,onThrow) that execute probes when instrumented functions are called, including condition evaluation, snapshot capture, template message rendering, and rate limiting.domain/activeEntries.ts— Tracks per-probe execution stacks for correlating entry/return/throw events, extracted to break the dependency cycle betweenapi.tsandprobes.ts.domain/probes.ts— Probe lifecycle management (add, remove, clear) with per-probe and global snapshot rate limiting. Compiles probe conditions and template segments on registration.domain/capture.ts— Deep value capture for arguments, locals, return values, and thrown errors with configurable reference depth, collection size limits, and string length limits.domain/expression.ts— Expression compiler that parses JSON expression trees (comparisons, logical operators, member access, string operations, etc.) into executable functions.domain/condition.ts— Probe condition evaluator that compiles and caches condition expressions.domain/template.ts— Template segment compiler and evaluator for rendering dynamic probe messages with runtime context.domain/stacktrace.ts— Stack trace capture and parsing fromErrorobjects.domain/deliveryApi.ts— Polling-based probe delivery client that fetches probe updates/deletions from the Delivery API using a cursor for incremental sync.transport/startDebuggerBatch.ts— Transport layer that reuses@datadog/browser-core's batch/flush infrastructure to send debugger snapshots to the logs intake.entries/main.ts— Public API surface (datadogDebugger.init()). Exposes$dd_entry/$dd_return/$dd_throw/$dd_probeshooks onglobalThisfor instrumented code. Defines the globalDD_DEBUGGERobject.Changes to
@datadog/browser-core'dd_debugger'as a valid source in configuration and transport types, mapped to'browser'for the SDK source.computeTransportConfigurationand theBatchtype so the debugger package can create its own transport.E2E test framework and scenarios
test/e2e/scenario/debugger.scenario.ts— 7 E2E test scenarios covering: basic snapshot sending, argument/return value capture, exception capture on throw, template message evaluation with expression segments, condition evaluation (both met and not met), and RUM correlation..withDebugger()builder method tocreateTest(),DebuggerIntakeRequesttype andintakeRegistry.debuggerEventsfor asserting on debugger events, debugger page setups for CDN/bundle/npm modes, and default debugger configuration.test/apps/vanilla/app.ts— Added@datadog/browser-debuggerimport andDEBUGGER_INITsupport so debugger E2E tests work in the npm setup.Performance benchmarks
test/apps/instrumentation-overhead/— Webpack test app for measuring instrumentation overhead with instrumented vs. uninstrumented function variants.test/performance/scenarios/instrumentationOverhead.scenario.ts— Benchmark scenario that stress-tests 10M function calls to measure the overhead of debugger instrumentation hooks.test/performance/createBenchmarkTest.ts— Extended withinstrumented_no_probesandinstrumented_with_probesscenario configurations and a dedicatedinjectDebuggerfunction.Tooling
scripts/build/build-test-apps.tsto include the new test app and to use resolution paths when installing peer dependencies (needed for unpublished packages like@datadog/browser-debuggerthat only exist locally as.tgzfiles).scripts/dev-server/lib/server.tsto serve the debugger bundle.Test instructions
yarn test:unit --spec "packages/debugger/src/**/*.spec.ts"yarn test:e2e:init && yarn test:e2e -g "debugger"yarn build:apps && yarn test:performanceChecklist
Tested on staging— N/A, this is a new pre-production package not yet deployed to any environment