Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ test/e2e/scenario/recorder/** @Datadog/rum-browser @Datadog/se

# Docs
/README.md @Datadog/rum-browser @DataDog/documentation

# Debugger
packages/debugger @Datadog/rum-browser @DataDog/debugger
packages/debugger/README.md @Datadog/rum-browser @DataDog/debugger @DataDog/documentation
test/apps/instrumentation-overhead @Datadog/rum-browser @DataDog/debugger
test/e2e/scenario/debugger.scenario.ts @Datadog/rum-browser @DataDog/debugger
test/performance/scenarios/instrumentationOverhead.scenario.ts @Datadog/rum-browser @DataDog/debugger
1 change: 1 addition & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dev,@vitejs/plugin-react,MIT,Copyright (c) 2019-present Evan You & Vite Contribu
dev,@vitejs/plugin-vue,MIT,Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
dev,@module-federation/enhanced,MIT, Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson) Zhou Shaw (zhouxiao)
dev,@vue/test-utils,MIT,Copyright (c) 2021-present vuejs
dev,acorn,MIT,Copyright (C) 2012-2022 by various contributors (see AUTHORS)
dev,ajv,MIT,Copyright 2015-2017 Evgeny Poberezkin
dev,babel-loader,MIT,Copyright (c) 2014-2019 Luís Couto <hello@luiscouto.pt>
dev,browserstack-local,MIT,Copyright 2016 BrowserStack
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 @@ -29,6 +29,7 @@ const pathsWithSideEffect = new Set([
`${packagesRoot}/logs/src/entries/main.ts`,
`${packagesRoot}/rum/src/entries/main.ts`,
`${packagesRoot}/rum-slim/src/entries/main.ts`,
`${packagesRoot}/debugger/src/entries/main.ts`,
])

// Those packages are known to have no side effects when evaluated
Expand Down
15 changes: 12 additions & 3 deletions packages/core/src/domain/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,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 @@ -311,6 +311,8 @@ export interface ReplicaUserConfiguration {
clientToken: string
}

export type SdkSource = 'browser' | 'flutter' | 'unity'

export interface Configuration extends TransportConfiguration {
// Built from init configuration
beforeSend: GenericBeforeSendCallback | undefined
Expand All @@ -331,10 +333,14 @@ export interface Configuration extends TransportConfiguration {

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

function toSdkSource(source: TransportConfiguration['source']): SdkSource {
return source === 'dd_debugger' ? 'browser' : source
}

function isString(tag: unknown, tagName: string): tag is string | undefined | null {
if (tag !== undefined && tag !== null && typeof tag !== 'string') {
display.error(`${tagName} must be defined as a string`)
Expand Down Expand Up @@ -398,6 +404,8 @@ export function validateAndBuildConfiguration(
return
}

const transportConfiguration = computeTransportConfiguration(initConfiguration)

return {
beforeSend:
initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),
Expand All @@ -423,7 +431,8 @@ export function validateAndBuildConfiguration(
variant: initConfiguration.variant,
sdkVersion: initConfiguration.sdkVersion,

...computeTransportConfiguration(initConfiguration),
...transportConfiguration,
source: toSdkSource(transportConfiguration.source),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { InitConfiguration } from './configuration'
// replaced at build time
declare const __BUILD_ENV__SDK_VERSION__: string

export type TrackType = 'logs' | 'rum' | 'replay' | 'profile' | 'exposures' | 'flagevaluation'
export type TrackType = 'logs' | 'rum' | 'replay' | 'profile' | 'exposures' | 'flagevaluation' | 'debugger'
export type ApiType =
| 'fetch'
| 'beacon'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ export interface TransportConfiguration {
profilingEndpointBuilder: EndpointBuilder
exposuresEndpointBuilder: EndpointBuilder
flagEvaluationEndpointBuilder: EndpointBuilder
debuggerEndpointBuilder: EndpointBuilder
datacenter?: string | undefined
replica?: ReplicaConfiguration
site: Site
source: 'browser' | 'flutter' | 'unity'
source: 'browser' | 'flutter' | 'unity' | 'dd_debugger'
}

export interface ReplicaConfiguration {
Expand All @@ -38,7 +39,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 All @@ -52,6 +53,7 @@ function computeEndpointBuilders(initConfiguration: InitConfiguration) {
sessionReplayEndpointBuilder: createEndpointBuilder(initConfiguration, 'replay'),
exposuresEndpointBuilder: createEndpointBuilder(initConfiguration, 'exposures'),
flagEvaluationEndpointBuilder: createEndpointBuilder(initConfiguration, 'flagevaluation'),
debuggerEndpointBuilder: createEndpointBuilder(initConfiguration, 'debugger'),
}
}

Expand Down
11 changes: 10 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
isSampleRate,
buildEndpointHost,
isIntakeUrl,
computeTransportConfiguration,
} from './domain/configuration'
export * from './domain/intakeSites'
export type { TrackingConsentState } from './domain/trackingConsent'
Expand Down Expand Up @@ -57,7 +58,15 @@ export {
SESSION_NOT_TRACKED,
SessionPersistence,
} from './domain/session/sessionConstants'
export type { BandwidthStats, HttpRequest, HttpRequestEvent, Payload, FlushEvent, FlushReason } from './transport'
export type {
Batch,
BandwidthStats,
HttpRequest,
HttpRequestEvent,
Payload,
FlushEvent,
FlushReason,
} from './transport'
export {
createHttpRequest,
canUseEventBridge,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/transport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type { BandwidthStats, HttpRequest, HttpRequestEvent, Payload, RetryInfo
export { createHttpRequest } from './httpRequest'
export type { BrowserWindowWithEventBridge, DatadogEventBridge } from './eventBridge'
export { canUseEventBridge, bridgeSupports, getEventBridge, BridgeCapability } from './eventBridge'
export type { Batch } from './batch'
export { createBatch } from './batch'
export type { FlushController, FlushEvent, FlushReason } from './flushController'
export { createFlushController, FLUSH_DURATION_LIMIT } from './flushController'
5 changes: 5 additions & 0 deletions test/unit/browsers.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import type { BrowserConfiguration } from '../browsers.conf'

// The ECMAScript version supported by the oldest browser in the list below (Chrome 63 → ES2017).
// Used by tests that validate runtime-generated code strings (e.g. the expression compiler) which
// bypass TypeScript/webpack transpilation and must only use syntax supported by all target browsers.
export const OLDEST_BROWSER_ECMA_VERSION = 2017

export const browserConfigurations: BrowserConfiguration[] = [
{
sessionName: 'Edge',
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@

"@datadog/browser-rum-nextjs": ["./packages/rum-nextjs/src/entries/main"],

"@datadog/browser-worker": ["./packages/worker/src/entries/main"]
"@datadog/browser-worker": ["./packages/worker/src/entries/main"],

"@datadog/browser-debugger": ["./packages/debugger/src/entries/main"]
}
}
}
2 changes: 1 addition & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"entryPointStrategy": "packages",
"includeVersion": true,
"exclude": ["packages/core", "packages/rum-core", "packages/worker"],
"exclude": ["packages/core", "packages/rum-core", "packages/worker", "packages/debugger"],
"validation": {
"notExported": true,
"invalidLink": true,
Expand Down
11 changes: 10 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,15 @@ __metadata:
languageName: unknown
linkType: soft

"@datadog/browser-debugger@workspace:packages/debugger":
version: 0.0.0-use.local
resolution: "@datadog/browser-debugger@workspace:packages/debugger"
dependencies:
"@datadog/browser-core": "npm:6.32.0"
acorn: "npm:8.16.0"
languageName: unknown
linkType: soft

"@datadog/browser-logs@workspace:*, @datadog/browser-logs@workspace:packages/logs":
version: 0.0.0-use.local
resolution: "@datadog/browser-logs@workspace:packages/logs"
Expand Down Expand Up @@ -3209,7 +3218,7 @@ __metadata:
languageName: node
linkType: hard

"acorn@npm:^8.15.0, acorn@npm:^8.16.0":
"acorn@npm:8.16.0, acorn@npm:^8.15.0, acorn@npm:^8.16.0":
version: 8.16.0
resolution: "acorn@npm:8.16.0"
bin:
Expand Down
Loading