Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
bundle
cjs
esm
Expand Down
1 change: 1 addition & 0 deletions eslint-local-rules/disallowSideEffects.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const pathsWithSideEffect = new Set([
`${packagesRoot}/flagging/src/entries/main.ts`,
`${packagesRoot}/rum/src/entries/main.ts`,
`${packagesRoot}/rum-slim/src/entries/main.ts`,
`${packagesRoot}/live-debugger/src/entries/main.ts`,
])

// Those packages are known to have no side effects when evaluated
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/domain/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export interface InitConfiguration {
*
* @internal
*/
source?: 'browser' | 'flutter' | 'unity' | undefined
source?: 'browser' | 'flutter' | 'unity' | 'dd_debugger' | undefined

/**
* [Internal option] Additional configuration for the SDK.
Expand Down Expand Up @@ -328,7 +328,7 @@ export interface Configuration extends TransportConfiguration {

// internal
sdkVersion: string | undefined
source: 'browser' | 'flutter' | 'unity'
source: 'browser' | 'flutter' | 'unity' | 'dd_debugger'
variant: string | undefined
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface TransportConfiguration {
datacenter?: string | undefined
replica?: ReplicaConfiguration
site: Site
source: 'browser' | 'flutter' | 'unity'
source: 'browser' | 'flutter' | 'unity' | 'dd_debugger'
}

export interface ReplicaConfiguration {
Expand All @@ -37,7 +37,7 @@ export function computeTransportConfiguration(initConfiguration: InitConfigurati
}

function validateSource(source: string | undefined) {
if (source === 'flutter' || source === 'unity') {
if (source === 'flutter' || source === 'unity' || source === 'dd_debugger') {
return source
}
return 'browser'
Expand Down
10 changes: 9 additions & 1 deletion packages/core/src/domain/telemetry/telemetryEvent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,15 @@ export interface CommonTelemetryProperties {
/**
* The source of this event
*/
readonly source: 'android' | 'ios' | 'browser' | 'flutter' | 'react-native' | 'unity' | 'kotlin-multiplatform'
readonly source:
| 'android'
| 'ios'
| 'browser'
| 'flutter'
| 'react-native'
| 'unity'
| 'kotlin-multiplatform'
| 'dd_debugger'
/**
* The version of the SDK generating the telemetry event
*/
Expand Down
83 changes: 83 additions & 0 deletions packages/live-debugger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Live Debugger Browser Monitoring

Datadog Live Debugger enables you to capture function execution snapshots, evaluate conditions, and collect runtime data from your application without modifying source code.

## Usage

To start using the live debugger, add [`@datadog/browser-live-debugger`](https://www.npmjs.com/package/@datadog/browser-live-debugger) to your `package.json` file, then initialize it with:

```javascript
import { datadogLiveDebugger } from '@datadog/browser-live-debugger'

datadogLiveDebugger.init({
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
service: 'my-web-application',
env: 'production',
version: '1.0.0',
})

// Add probes programmatically
datadogLiveDebugger.addProbe({
id: 'probe-1',
version: 0,
type: 'LOG_PROBE',
where: { typeName: 'MyClass', methodName: 'myMethod' },
template: 'Method executed with duration: {@duration}ms',
segments: [
{ str: 'Method executed with duration: ' },
{ dsl: '@duration', json: { ref: '@duration' } },
{ str: 'ms' },
],
captureSnapshot: true,
capture: { maxReferenceDepth: 3 },
sampling: { snapshotsPerSecond: 5000 },
evaluateAt: 'EXIT',
})
```

**Note**: Dynamic probe management from remote configuration will be added in a future release.

## Integration with RUM

The Live Debugger integrates seamlessly with Datadog RUM to provide enhanced context and correlation:

```javascript
import { datadogRum } from '@datadog/browser-rum'
import { datadogLiveDebugger } from '@datadog/browser-live-debugger'

// Initialize RUM first
datadogRum.init({
applicationId: '<DATADOG_APPLICATION_ID>',
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
service: 'my-web-application',
env: 'production',
})

// Then initialize Live Debugger
datadogLiveDebugger.init({
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
service: 'my-web-application',
env: 'production',
})

// Add your probe configurations
// datadogLiveDebugger.addProbe({ ... })
```

When both are initialized, debugger snapshots will automatically include RUM context (session, view, user action).

## Features

- **Dynamic Instrumentation**: Capture function entry/exit without code changes
- **Conditional Breakpoints**: Evaluate conditions before capturing snapshots
- **Template Expressions**: Evaluate custom messages with runtime context
- **Rate Limiting**: Built-in sampling to prevent performance impact
- **Stack Traces**: Automatic stack trace capture for debugging
- **Variable Capture**: Deep capture of arguments, locals, and return values

<!-- Note: all URLs should be absolute -->

[1]: https://docs.datadoghq.com/dynamic_instrumentation/
34 changes: 34 additions & 0 deletions packages/live-debugger/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@datadog/browser-live-debugger",
"version": "6.24.1",
"license": "Apache-2.0",
"main": "cjs/entries/main.js",
"module": "esm/entries/main.js",
"types": "cjs/entries/main.d.ts",
"scripts": {
"build": "node ../../scripts/build/build-package.ts --modules --bundle datadog-live-debugger.js",
"build:bundle": "node ../../scripts/build/build-package.ts --bundle datadog-live-debugger.js"
},
"dependencies": {
"@datadog/browser-core": "6.24.1"
},
"peerDependencies": {
"@datadog/browser-rum-core": "6.24.1"
},
"peerDependenciesMeta": {
"@datadog/browser-rum-core": {
"optional": true
}
},
"repository": {
"type": "git",
"url": "https://github.com/DataDog/browser-sdk.git",
"directory": "packages/live-debugger"
},
"volta": {
"extends": "../../package.json"
},
"publishConfig": {
"access": "public"
}
}
Loading
Loading