Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e053a7d
Move resourceTraceSampleRate, nativeLongTaskThreshold, nativeCrashRep…
sbarrio Dec 18, 2025
27a2cdc
Fix iOS tests
sbarrio Dec 18, 2025
7c79ef3
Fix Android tests
sbarrio Dec 18, 2025
6c79299
Expose optional Rum, Logs and Trace configuration objects on Datado…
sbarrio Dec 18, 2025
7bea519
Missing changes to sdk init on examples/benchmarks
sbarrio Dec 19, 2025
2d784e0
Configuration constructor now retains default values
sbarrio Dec 19, 2025
4c47f03
Update snapshots
sbarrio Dec 19, 2025
b0f5d5d
Refactored Initialization APIs and configs
marco-saia-datadog Dec 19, 2025
ae29df9
review: using parsed RN version in test snapshot
marco-saia-datadog Jan 5, 2026
75f5493
Remove unused import
sbarrio Jan 5, 2026
0abc900
Ensure SDK does not crash if module configuration is missing
sbarrio Jan 5, 2026
76e562d
Merge branch 'marcosaia/chore/refactor-init-apis' of github.com:DataD…
sbarrio Jan 5, 2026
dfefce0
Fix linting issues on native tests
sbarrio Jan 7, 2026
64ab432
review: using parsed RN version in test snapshot
marco-saia-datadog Jan 5, 2026
9c96597
Fix linting issues on native tests
sbarrio Jan 7, 2026
11a16a6
Merge
sbarrio Jan 7, 2026
292bbb6
Fix linting issues on native tests
sbarrio Jan 7, 2026
7ea024a
Merge branch 'marcosaia/chore/refactor-init-apis' of github.com:DataD…
sbarrio Jan 7, 2026
1f163a4
Cleanup
sbarrio Jan 8, 2026
80510dd
Added MIGRATION.md and modified CONTRIBUTING.md to acknowledge init A…
sbarrio Jan 9, 2026
ebe4345
Update READMEs and cleaned up on sample apps
sbarrio Jan 9, 2026
cccbabe
Update packages/react-navigation/README.md
sbarrio Jan 12, 2026
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
21 changes: 15 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,26 @@ use_frameworks!
Now you can go back to your `App.js/tsx` and use `@datadog/mobile-react-native` from there
Example code:
```
import { DdSdkReactNative, DdSdkReactNativeConfiguration } from '@datadog/mobile-react-native';
import { DdSdkReactNative, CoreConfiguration, TrackingConsent } from '@datadog/mobile-react-native';

const App: () => React$Node = () => {
const config = new DdSdkReactNativeConfiguration(
const config = new CoreConfiguration(
"<CLIENT_TOKEN>",
"<ENVIRONMENT_NAME>",
"<RUM_APPLICATION_ID>",
true, // track User interactions (e.g.: Tap on buttons)
true, // track XHR Resources
true // track Errors
TrackingConsent.GRANTED,
{
rumConfiguration: {
applicationId: APPLICATION_ID,
trackInteractions: true,
trackResources: true,
trackFrustrations: true,
trackErrors: true,
},
logsConfiguration: {},
traceConfiguration: {}
}
)

DdSdkReactNative.initialize(config);
...
```
Expand Down
239 changes: 239 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
# Migration Guide

This document outlines breaking changes and migration steps between major versions of the project.

## Migration from 2.x to 3.0

This section describes the main changes introduced in SDK `3.0` compared to `2.x`.

### Core SDK Initialization changes

The configuration object used to initialize the SDK has seen some changes in its structure.
Feature configuration is now split into feature-specific properties: rumConfiguration, logsConfiguration, traceConfiguration.

Then, RUM, Logs and Trace can be independently configured via their optional configuration objects that are each represented by a property inside the core configuration object.

**NOTE: clientToken, environment and trackingConsent are mandatory for the Core SDK initialization.
ApplicationID is mandatory for RUM to work.**

For instance, to configure the SDK and enable RUM, Logs and Trace you'd do the following:

```
const config = new CoreConfiguration(
CLIENT_TOKEN,
ENVIRONMENT,
TrackingConsent.GRANTED,
{
rumConfiguration: {
applicationId: APPLICATION_ID,
trackInteractions: true,
trackResources: true,
trackFrustrations: true,
sessionSampleRate: 100,
telemetrySampleRate: 100
}
},
logsConfiguration: {
logEventMapper: (logEvent) => {
logEvent.message = `[CUSTOM] ${logEvent.message}`;
return logEvent;
}
},
traceConfiguration: {}
);

...

await DdSdkReactNative.initialize(config);
```

Or if using the DatadogProvider wrapper:

```
const configuration = new DatadogProviderConfiguration(
CLIENT_TOKEN,
ENVIRONMENT,
TrackingConsent.GRANTED,
{
batchSize: BatchSize.SMALL,
uploadFrequency: UploadFrequency.FREQUENT,
batchProcessingLevel: BatchProcessingLevel.MEDIUM,
additionalConfiguration: {
customProperty: "sdk-example-app"
},
rumConfiguration: {
applicationId: APPLICATION_ID,
trackInteractions: true,
trackResources: true,
trackErrors: true,
sessionSampleRate: 100,
nativeCrashReportEnabled: true
},
logsConfiguration: {
logEventMapper: (logEvent) => {
logEvent.message = `[CUSTOM] ${logEvent.message}`;
return logEvent;
}
},
traceConfiguration: {}
}
);

...

<DatadogProvider configuration={configuration} onInitialization={onDatadogInitialization}>
```

**NOTE: Unlike v2.x, which would always enable all feature modules when initializing the SDK, v3 won't initialize nor enable a feature module if there's no configuration for it.**

### Property renames and relocations

| Property | New Location | Changes |
| :--- | :--- | :--- |
| `sampleRate` | *Removed* | Deprecated property removed. |
| `sessionSamplingRate` | `RumConfiguration` | Moved and renamed to `sessionSampleRate` |
| `resourceTracingSamplingRate` | `RumConfiguration` | Moved and renamed to `resourceTraceSampleRate`. |
| `proxyConfig` | `CoreConfiguration` | Renamed to `proxyConfiguration`. |
| `serviceName` | `CoreConfiguration` | Renamed to `service`. |
| `customEndpoints` | *Split* | Split into `customEndpoint` within `RumConfiguration`, `LogsConfiguration`, and `TraceConfiguration` |
| *New Property* | `CoreConfiguration` | `attributeEncoders` added. |
| *New Property* | `RumConfiguration` | `trackMemoryWarnings` added. |
| `nativeCrashReportEnabled` | `RumConfiguration` | Moved. |
| `nativeViewTracking` | `RumConfiguration` | Moved. |
| `nativeInteractionTracking` | `RumConfiguration` | Moved. |
| `firstPartyHosts` | `RumConfiguration` | Moved. |
| `telemetrySampleRate` | `RumConfiguration` | Moved. |
| `nativeLongTaskThresholdMs` | `RumConfiguration` | Moved. |
| `longTaskThresholdMs` | `RumConfiguration` | Moved. |
| `vitalsUpdateFrequency` | `RumConfiguration` | Moved. |
| `trackFrustrations` | `RumConfiguration` | Moved. |
| `trackBackgroundEvents` | `RumConfiguration` | Moved. |
| `bundleLogsWithRum` | `LogsConfiguration` | Moved. |
| `bundleLogsWithTraces` | `LogsConfiguration` | Moved. |
| `trackNonFatalAnrs` | `RumConfiguration` | Moved. |
| `appHangThreshold` | `RumConfiguration` | Moved. |
| `initialResourceThreshold` | `RumConfiguration` | Moved. |
| `trackWatchdogTerminations` | `RumConfiguration` | Moved. |
| `actionNameAttribute` | `RumConfiguration` | Moved. |
| `logEventMapper` | `LogsConfiguration` | Moved. |
| `errorEventMapper` | `RumConfiguration` | Moved. |
| `resourceEventMapper` | `RumConfiguration` | Moved. |
| `actionEventMapper` | `RumConfiguration` | Moved. |`TraceConfiguration`. |
| `useAccessibilityLabel` | `RumConfiguration` | Moved. |
| `trackInteractions` | `RumConfiguration` | Moved. |
| `trackResources` | `RumConfiguration` | Moved. |
| `trackErrors` | `RumConfiguration` | Moved. |

### FileBasedConfiguration changes

FileBasedConfiguration now requires a path to a configuration JSON file instead of trying to find a default `datadog-configuration.json` at the app's root level like it did on v2.

### Changes to SessionReplay configuration
defaultPrivacyLevel has been removed in favor of granular options: imagePrivacyLevel, touchPrivacyLevel and textAndInputPrivacyLevel.

### Fatal Errors are no longer reported as logs

Fatal Errors are no longer automatically reported as Logs. Fatal crashes will still be captured, but are no longer duplicated in Logs by default.

### Context / Attribute encoding
Context / attributes encoding is now safe and deterministic
All attributes passed to Datadog SDK APIs are automatically sanitized and encoded:
Unsupported values (functions, symbols, non-finite numbers, etc.) are dropped with a warning to prevent crashes and undefined behavior
Common types (Date, Error, Map) are properly serialized
Nested objects are flattened using dot notation (a.b.c = value) to match native SDK expectations
Root-level primitives and arrays are wrapped under a context key for schema consistency
Custom encoders can be registered via the attributeEncoders configuration option for domain-specific types

### Android mindSdkVersion bumped to 23
Android's minSdkVersion has been bumped to 23.

### Resource Traces sampling aligned with RUM Sessions
Resource traces are now consistently sampled based on the active RUM session.
You may notice changes in the percentage of reported resources.

### JS Refresh rate normalization changes
JS refresh rate is now normalized to a 0–60 FPS range.

### RUM Session sampling changes
v3 modifies the logic to determine whether a trace should be sampled or not, by using the RUM Session ID first, before using the Trace sampling if no session can be found.

Consistent trace sampling based on RUM Session ID allows RUM clients and the backend to come to a the same decision about sampling without relying on randomness for each trace.

### Removed APIs

| API | Status |
| :--- | :--- |
| setUser | Removed in favor of setUserInfo. To completely remove userInfo please use the newly added clearUserInfo |
| setAttributes| Removed in favor of addAttributes |

### Attributes API
The attribute API has been expanded allowing for addition and removal of single or batches of attributes in bulk.This can be performed with the new granular APIs: addAttributes, removeAttributes, addAttribute and removeAttribute.

### New APIs

#### ViewAttributes

RUM View-level attributes are now automatically propagated to all related child events, including resources, user actions, errors, and long tasks. This ensures consistent metadata across events, making it easier to filter and correlate data on Datadog dashboards.

To manage View level attributes more effectively, new APIs were added:

```
addViewAttribute = (key: string, value: unknown)
removeViewAttribute = (key: string)
addViewAttributes = (attributes: Attributes)
removeViewAttributes = (keys: string[])
```

#### AccountInfo
The AccountInfo API from the native Datadog SDKs has been exposed to React Native as well:

```
setAccountInfo = async (accountInfo: {
id: string;
name?: string;
extraInfo?: Record<string, unknown>;
})

clearAccountInfo = async ()

addAccountExtraInfo = async (extraAccountInfo: Record<string, unknown>)
```

#### Feature Operations

```
startFeatureOperation(
name: string,
operationKey: string | null,
attributes: object
): Promise<void>

succeedFeatureOperation(
name: string,
operationKey: string | null,
attributes: object
): Promise<void>

failFeatureOperation(
name: string,
operationKey: string | null,
reason: FeatureOperationFailure,
attributes: object
): Promise<void>
```

### New Navigation Tracking Options

v3 modifies the automatic navigation tracking modules for React Navigation and React Native Navigation and exposes a new NavigationTrackingOptions parameter through the startTracking/startTrackingViews function.

This `options` object allows to customize the view tracking logic via 3 new optional predicate functions:

- ViewNamePredicate - a custom naming predicates that decide the display name of views tracked by RUM.
- ViewTrackingPredicate - a custom predicate that decides if a view needs to be tracked by RUM or not.
- ParamsTrackingPredicate - a custom predicate that decides which navigation parameters (if any) need to be tracked alongside the view on RUM.

All of these are optional, and when not set the default behavior will be used for each one of them. The default behaviours are as follows:

- ViewNamePredicate - directly forwards the view given name to RUM.
- ViewTrackingPredicate - tracks all views on RUM.
- ParamsTrackingPredicate - does not forward any parameters to RUM.
31 changes: 22 additions & 9 deletions benchmarks/src/testSetup/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
DatadogProviderConfiguration,
DdSdkReactNative,
CoreConfiguration,
RumConfiguration,
SdkVerbosity,
TrackingConsent
} from '@datadog/mobile-react-native';
Expand Down Expand Up @@ -41,14 +40,21 @@ export const getDatadogProviderConfig = () => {
let config = new DatadogProviderConfiguration(
baseConfig.clientToken ?? '',
baseConfig.env ?? '',
TrackingConsent.GRANTED
TrackingConsent.GRANTED,
{
rumConfiguration: {
applicationId: baseConfig.applicationID ?? '',
trackInteractions: true,
trackResources: true,
trackErrors: true,
sessionSampleRate: 100,
nativeCrashReportEnabled: true
}
}
);
config.service = `com.rn.${platform}.benchmark`
config.verbosity = SdkVerbosity.DEBUG;
config.nativeCrashReportEnabled = true

config.rumConfiguration = new RumConfiguration(baseConfig.applicationID ?? '', true, true, true);
config.rumConfiguration.sessionSampleRate = 100;

return config;
};
Expand All @@ -58,13 +64,20 @@ export const initializeDatadog = (clientToken?: string, environment?: string, ap
const config = new CoreConfiguration(
clientToken ?? '',
environment ?? '',
TrackingConsent.GRANTED
TrackingConsent.GRANTED,
{
rumConfiguration: {
applicationId: appId,
trackInteractions: true,
trackResources: true,
trackErrors: true,
sessionSampleRate: 100,
nativeCrashReportEnabled: true,
}
}
);
config.service = `com.rn.${platform}.benchmark`
config.verbosity = SdkVerbosity.DEBUG;
config.nativeCrashReportEnabled = true
config.rumConfiguration = new RumConfiguration(appId ?? '', true, true, true)
config.rumConfiguration.sessionSampleRate = 100;

return DdSdkReactNative.initialize(config);
};
Expand Down
23 changes: 14 additions & 9 deletions example-new-architecture/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
RumActionType,
DdLogs,
DdTrace,
RumConfiguration,
TrackingConsent,
} from '@datadog/mobile-react-native';
import React from 'react';
import type {PropsWithChildren} from 'react';
Expand Down Expand Up @@ -36,18 +36,23 @@ import {APPLICATION_ID, CLIENT_TOKEN, ENVIRONMENT} from './ddCredentials';
const config = new CoreConfiguration(
CLIENT_TOKEN,
ENVIRONMENT,
TrackingConsent.GRANTED,
{
rumConfiguration: {
applicationId: APPLICATION_ID,
trackInteractions: true,
trackResources: true,
trackFrustrations: true,
trackErrors: true,
sessionSampleRate: 100,
telemetrySampleRate: 100,
}
}
);
config.verbosity = SdkVerbosity.DEBUG;
config.uploadFrequency = UploadFrequency.FREQUENT;
config.batchSize = BatchSize.SMALL;
config.rumConfiguration = new RumConfiguration(
APPLICATION_ID,
true,
true,
true
)
config.rumConfiguration.sessionSampleRate = 100;
config.rumConfiguration.telemetrySampleRate = 100;


await DdSdkReactNative.initialize(config);
await DdRum.startView('main', 'Main');
Expand Down
6 changes: 2 additions & 4 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import ErrorScreen from './screens/ErrorScreen';
import AboutScreen from './screens/AboutScreen';
import style from './screens/styles';
import { navigationRef } from './NavigationRoot';
import { DdRumReactNavigationTracking, ViewNamePredicate } from '@datadog/mobile-react-navigation';
import {DatadogProvider, DatadogProviderConfiguration, FileBasedConfiguration, RumConfiguration} from '@datadog/mobile-react-native'
import { DdRumReactNavigationTracking, NavigationTrackingOptions, ParamsTrackingPredicate, ViewNamePredicate, ViewTrackingPredicate } from '@datadog/mobile-react-navigation';
import {DatadogProvider } from '@datadog/mobile-react-native'
import { Route } from "@react-navigation/native";
import { NestedNavigator } from './screens/NestedNavigator/NestedNavigator';
import { getDatadogConfig, onDatadogInitialization } from './ddUtils';
import { TrackingConsent } from '@datadog/mobile-react-native';
import { NavigationTrackingOptions, ParamsTrackingPredicate, ViewTrackingPredicate } from '@datadog/mobile-react-navigation/src/rum/instrumentation/DdRumReactNavigationTracking';

const Tab = createBottomTabNavigator();

Expand Down Expand Up @@ -66,7 +65,6 @@ const configuration = getDatadogConfig(TrackingConsent.GRANTED)
// see https://docs.datadoghq.com/real_user_monitoring/guide/initialize-your-native-sdk-before-react-native-starts

// const configuration = new DatadogProviderConfiguration("fake_value", "fake_value");
// configuration.rumConfiguration = new RumConfiguration("fake_value")

export default function App() {

Expand Down
Loading