diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 289ebf68f6..c4f251c353 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -126,7 +126,10 @@ typecheck: interruptible: true script: - yarn + - yarn build - yarn typecheck + - scripts/cli typecheck test/app + - scripts/cli typecheck test/e2e build-and-lint: extends: @@ -137,8 +140,6 @@ build-and-lint: - yarn - yarn build - yarn lint - - scripts/cli typecheck test/app - - scripts/cli typecheck test/e2e build-bundle: extends: diff --git a/developer-extension/package.json b/developer-extension/package.json index d7458080f8..16975b2fab 100644 --- a/developer-extension/package.json +++ b/developer-extension/package.json @@ -16,6 +16,8 @@ "webpack": "5.88.1" }, "dependencies": { + "@datadog/browser-logs": "workspace:*", + "@datadog/browser-rum": "workspace:*", "@emotion/react": "11.11.1", "@mantine/core": "6.0.16", "@mantine/hooks": "6.0.16", diff --git a/developer-extension/src/panel/components/alert.tsx b/developer-extension/src/panel/components/alert.tsx index ae99887336..58197ba0bc 100644 --- a/developer-extension/src/panel/components/alert.tsx +++ b/developer-extension/src/panel/components/alert.tsx @@ -15,7 +15,7 @@ export function Alert({ }) { const color = level === 'warning' ? ('orange' as const) : ('red' as const) return ( -
+
{message} {button && ( diff --git a/developer-extension/src/panel/components/panel.tsx b/developer-extension/src/panel/components/panel.tsx index 0d34902869..23908c8ca2 100644 --- a/developer-extension/src/panel/components/panel.tsx +++ b/developer-extension/src/panel/components/panel.tsx @@ -32,7 +32,7 @@ export function Panel() { defaultValue={PanelTabs.Events} sx={{ height: '100vh', display: 'flex', flexDirection: 'column' }} > - + Events Infos diff --git a/developer-extension/src/panel/components/tabs/eventsTab.tsx b/developer-extension/src/panel/components/tabs/eventsTab.tsx index a8c6232f90..688c3dafcf 100644 --- a/developer-extension/src/panel/components/tabs/eventsTab.tsx +++ b/developer-extension/src/panel/components/tabs/eventsTab.tsx @@ -35,7 +35,7 @@ export function EventTab({ events, filters, onFiltered, clear }: EventTabProps) return ( + onFiltered({ ...filters, query: event.currentTarget.value })} + className="dd-privacy-mask" /> @@ -47,7 +47,7 @@ export function InfosTab() { {infos.rum && ( <> {sessionId && ( - + {sessionId && ( - - Explorer - +
+ + Explorer + +
)} diff --git a/developer-extension/src/panel/components/tabs/settingsTab.tsx b/developer-extension/src/panel/components/tabs/settingsTab.tsx index 58f4b890a8..2d61830fd3 100644 --- a/developer-extension/src/panel/components/tabs/settingsTab.tsx +++ b/developer-extension/src/panel/components/tabs/settingsTab.tsx @@ -13,121 +13,123 @@ export function SettingsTab() { return ( - - - +
+ + + + setSetting('useDevBundles', isChecked(e.target))} + color="violet" + /> + {devServerStatus === DevServerStatus.AVAILABLE ? ( + Available + ) : devServerStatus === DevServerStatus.CHECKING ? ( + Checking... + ) : ( + Unavailable + )} + + } + description={ + <> + Use the local development bundles served by the Browser SDK development server. To start the + development server, run yarn dev in the Browser SDK root folder. + + } + /> + + setSetting('useDevBundles', isChecked(e.target))} + label="Use RUM Slim" + checked={useRumSlim} + onChange={(e) => setSetting('useRumSlim', isChecked(e.target))} color="violet" /> - {devServerStatus === DevServerStatus.AVAILABLE ? ( - Available - ) : devServerStatus === DevServerStatus.CHECKING ? ( - Checking... - ) : ( - Unavailable - )} - - } - description={ - <> - Use the local development bundles served by the Browser SDK development server. To start the development - server, run yarn dev in the Browser SDK root folder. - - } - /> + } + description={ + <>If the page is using the RUM CDN bundle, this bundle will be replaced by the RUM Slim CDN bundle. + } + /> - setSetting('useRumSlim', isChecked(e.target))} - color="violet" - /> - } - description={ - <>If the page is using the RUM CDN bundle, this bundle will be replaced by the RUM Slim CDN bundle. - } - /> + setSetting('blockIntakeRequests', isChecked(e.target))} + color="violet" + /> + } + description={<>Block requests made to the intake, preventing any data to be sent to Datadog.} + /> + - setSetting('blockIntakeRequests', isChecked(e.target))} - color="violet" - /> - } - description={<>Block requests made to the intake, preventing any data to be sent to Datadog.} - /> - + + setSetting('preserveEvents', isChecked(e.target))} + color="violet" + /> + } + description={<>Don't clear events when reloading the page or navigating away.} + /> - - setSetting('preserveEvents', isChecked(e.target))} - color="violet" - /> - } - description={<>Don't clear events when reloading the page or navigating away.} - /> + + Events source: + setSetting('eventSource', value as EventSource)} + setSetting('autoFlush', isChecked(e.target))} color="violet" - sx={{ flex: 1 }} /> - - } - description={ - <> - {eventSource === 'requests' && ( - <> - Collect events by listening to intake HTTP requests: events need to be flushed to be collected. Any - SDK setup is supported. - - )} - {eventSource === 'sdk' && ( - <> - Collect events by listening to messages sent from the SDK: events are available as soon as they - happen. Only newer versions of the SDK are supported. - - )} - - } - /> - - setSetting('autoFlush', isChecked(e.target))} - color="violet" - /> - } - description={<>Force the SDK to flush events periodically.} - /> - - + } + description={<>Force the SDK to flush events periodically.} + /> + + +
) } diff --git a/developer-extension/src/panel/index.tsx b/developer-extension/src/panel/index.tsx index b582a06ce0..f05858cf2d 100644 --- a/developer-extension/src/panel/index.tsx +++ b/developer-extension/src/panel/index.tsx @@ -2,8 +2,10 @@ import { createRoot } from 'react-dom/client' import React from 'react' import { App } from './components/app' +import { initMonitoring } from './monitoring' const main = document.createElement('main') document.body.append(main) const root = createRoot(main) root.render() +initMonitoring() diff --git a/developer-extension/src/panel/monitoring.ts b/developer-extension/src/panel/monitoring.ts new file mode 100644 index 0000000000..8eec636c15 --- /dev/null +++ b/developer-extension/src/panel/monitoring.ts @@ -0,0 +1,37 @@ +import { datadogRum } from '@datadog/browser-rum' +import { datadogLogs } from '@datadog/browser-logs' +import packageJson from '../../package.json' + +export function initMonitoring() { + datadogRum.init({ + applicationId: '235202fa-3da1-4aeb-abc4-d01b10ca1539', + clientToken: 'pub74fd472504982beb427b647893758040', + site: 'datadoghq.com', + service: 'browser-sdk-developer-extension', + env: 'prod', + version: packageJson.version, + allowFallbackToLocalStorage: true, + sessionSampleRate: 100, + sessionReplaySampleRate: 100, + telemetrySampleRate: 100, + trackUserInteractions: true, + trackResources: true, + trackLongTasks: true, + defaultPrivacyLevel: 'mask', + }) + datadogRum.startSessionReplayRecording() + + datadogLogs.init({ + clientToken: 'pub74fd472504982beb427b647893758040', + site: 'datadoghq.com', + service: 'browser-sdk-developer-extension', + env: 'prod', + version: packageJson.version, + allowFallbackToLocalStorage: true, + forwardErrorsToLogs: true, + forwardConsoleLogs: 'all', + forwardReports: 'all', + sessionSampleRate: 100, + telemetrySampleRate: 100, + }) +} diff --git a/yarn.lock b/yarn.lock index 2c4ba9c9f1..ee4d0aeb18 100644 --- a/yarn.lock +++ b/yarn.lock @@ -404,7 +404,7 @@ __metadata: languageName: unknown linkType: soft -"@datadog/browser-logs@workspace:packages/logs": +"@datadog/browser-logs@workspace:*, @datadog/browser-logs@workspace:packages/logs": version: 0.0.0-use.local resolution: "@datadog/browser-logs@workspace:packages/logs" dependencies: @@ -440,7 +440,7 @@ __metadata: languageName: unknown linkType: soft -"@datadog/browser-rum@workspace:packages/rum": +"@datadog/browser-rum@workspace:*, @datadog/browser-rum@workspace:packages/rum": version: 0.0.0-use.local resolution: "@datadog/browser-rum@workspace:packages/rum" dependencies: @@ -461,6 +461,8 @@ __metadata: version: 0.0.0-use.local resolution: "@datadog/browser-sdk-developer-extension@workspace:developer-extension" dependencies: + "@datadog/browser-logs": "workspace:*" + "@datadog/browser-rum": "workspace:*" "@emotion/react": 11.11.1 "@mantine/core": 6.0.16 "@mantine/hooks": 6.0.16