Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [RUM-7371] move React integration out of beta #3160

Merged
merged 2 commits into from
Nov 26, 2024
Merged
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
4 changes: 2 additions & 2 deletions packages/rum-core/src/boot/preStartRum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ describe('preStartRum', () => {
createCustomVitalsState(),
doStartRumSpy
)
const initConfiguration: RumInitConfiguration = { ...DEFAULT_INIT_CONFIGURATION, betaPlugins: [plugin] }
const initConfiguration: RumInitConfiguration = { ...DEFAULT_INIT_CONFIGURATION, plugins: [plugin] }
strategy.init(initConfiguration, PUBLIC_API)

expect(plugin.onInit).toHaveBeenCalledWith({
Expand All @@ -543,7 +543,7 @@ describe('preStartRum', () => {
)
strategy.init(
{
betaPlugins: [plugin],
plugins: [plugin],
} as RumInitConfiguration,
PUBLIC_API
)
Expand Down
2 changes: 1 addition & 1 deletion packages/rum-core/src/boot/preStartRum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export function createPreStartStrategy(
return
}

callPluginsMethod(initConfiguration.betaPlugins, 'onInit', { initConfiguration, publicApi })
callPluginsMethod(initConfiguration.plugins, 'onInit', { initConfiguration, publicApi })

if (
initConfiguration.remoteConfigurationId &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ describe('validateAndBuildRumConfiguration', () => {
}
const configuration = validateAndBuildRumConfiguration({
...DEFAULT_INIT_CONFIGURATION,
betaPlugins: [plugin],
plugins: [plugin],
})
expect(configuration!.plugins).toEqual([plugin])
})
Expand Down Expand Up @@ -478,7 +478,7 @@ describe('serializeRumConfiguration', () => {
trackResources: true,
trackLongTasks: true,
remoteConfigurationId: '123',
betaPlugins: [{ name: 'foo', getConfigurationTelemetry: () => ({ bar: true }) }],
plugins: [{ name: 'foo', getConfigurationTelemetry: () => ({ bar: true }) }],
}

type MapRumInitConfigurationKey<Key extends string> = Key extends keyof InitConfiguration
Expand All @@ -489,9 +489,7 @@ describe('serializeRumConfiguration', () => {
? 'track_long_task' // oops
: Key extends 'applicationId' | 'subdomain' | 'remoteConfigurationId'
? never
: Key extends 'betaPlugins' // renamed during public beta
? 'plugins'
: CamelToSnakeCase<Key>
: CamelToSnakeCase<Key>

// By specifying the type here, we can ensure that serializeConfiguration is returning an
// object containing all expected properties.
Expand Down
6 changes: 3 additions & 3 deletions packages/rum-core/src/domain/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export interface RumInitConfiguration extends InitConfiguration {
* notice. Please use only plugins provided by Datadog matching the version of the SDK you are
* using.
*/
betaPlugins?: RumPlugin[] | undefined
plugins?: RumPlugin[] | undefined
}

export type HybridInitConfiguration = Omit<RumInitConfiguration, 'applicationId' | 'clientToken'>
Expand Down Expand Up @@ -213,7 +213,7 @@ export function validateAndBuildRumConfiguration(
traceContextInjection: objectHasValue(TraceContextInjection, initConfiguration.traceContextInjection)
? initConfiguration.traceContextInjection
: TraceContextInjection.ALL,
plugins: initConfiguration.betaPlugins || [],
plugins: initConfiguration.plugins || [],
},
baseConfiguration
)
Expand Down Expand Up @@ -295,7 +295,7 @@ export function serializeRumConfiguration(configuration: RumInitConfiguration) {
track_user_interactions: configuration.trackUserInteractions,
track_resources: configuration.trackResources,
track_long_task: configuration.trackLongTasks,
plugins: configuration.betaPlugins?.map((plugin) =>
plugins: configuration.plugins?.map((plugin) =>
assign({ name: plugin.name }, plugin.getConfigurationTelemetry?.())
),
},
Expand Down
9 changes: 3 additions & 6 deletions packages/rum-react/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# RUM Browser Monitoring - React integration

> [!CAUTION]
> This package is experimental. Use at your own risk.

This package provides React and React ecosystem integrations for Datadog Browser RUM.

## Installation
Expand All @@ -15,7 +12,7 @@ npm install @datadog/browser-rum @datadog/browser-rum-react

### Initialization

To enable the React integration, pass the `reactPlugin` to the `betaPlugins` option of the `datadogRum.init` method:
To enable the React integration, pass the `reactPlugin` to the `plugins` option of the `datadogRum.init` method:

```javascript
import { datadogRum } from '@datadog/browser-rum'
Expand All @@ -25,7 +22,7 @@ datadogRum.init({
applicationId: ...,
clientToken: ...,
...
betaPlugins: [reactPlugin()],
plugins: [reactPlugin()],
})
```

Expand Down Expand Up @@ -94,7 +91,7 @@ import { createBrowserRouter } from '@datadog/browser-rum-react/react-router-v6'

datadogRum.init({
...
betaPlugins: [reactPlugin({ router: true })],
plugins: [reactPlugin({ router: true })],
})

const router = createBrowserRouter([
Expand Down
1 change: 0 additions & 1 deletion packages/rum-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "@datadog/browser-rum-react",
"private": true,
"version": "5.31.1",
"license": "Apache-2.0",
"main": "cjs/entries/main.js",
Expand Down
2 changes: 1 addition & 1 deletion sandbox/react-app/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { reactPlugin, ErrorBoundary } from '@datadog/browser-rum-react'
datadogRum.init({
applicationId: 'xxx',
clientToken: 'xxx',
betaPlugins: [reactPlugin({ router: true })],
plugins: [reactPlugin({ router: true })],
})

const router = createBrowserRouter(
Expand Down