Closed
Conversation
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.
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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
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/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 (datadogLiveDebugger.init(),addProbe(),removeProbe(),clearProbes(),getProbes()). Exposes$dd_entry/$dd_return/$dd_throwhooks onglobalThisfor instrumented code.Changes to
@datadog/browser-core'dd_debugger'as a valid source in configuration and transport types.computeTransportConfigurationand theBatchtype so the debugger package can create its own transport.Sandbox / Tooling
sandbox/debugger/— Local testing sandbox with an HTML test page, sample probes, and a Remote Config proxy server for end-to-end manual testing against the Delivery API.test/apps/instrumentation-overhead/— Webpack test app for measuring instrumentation overhead.test/performance/— Newinstrumentation-overheadperformance benchmark scenario.scripts/build/build-test-apps.tsandscripts/dev-server/lib/server.tsto include the new test app.Test instructions
yarn test:unit --spec packages/debugger/src/domain/api.spec.ts(and similarly forcapture.spec.ts,condition.spec.ts,deliveryApi.spec.ts,expression.spec.ts,probes.spec.ts,stacktrace.spec.ts,template.spec.ts) — ~2,930 lines of spec coverage across 8 spec files.sandbox/debugger/rc-proxy/QUICKSTART.mdfor local end-to-end testing with the Delivery API proxy.yarn build:apps && yarn test:performanceto run the instrumentation overhead benchmark.Checklist